From: | dipti shah <shahdipti1980(at)gmail(dot)com> |
---|---|
To: | John R Pierce <pierce(at)hogranch(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Connect to postgresql database using Perl |
Date: | 2010-03-31 07:54:23 |
Message-ID: | p2od5b05a951003310054y241c0277lccbf0850bde0d71d@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-novice |
That was cool ! Thanks a ton. Got my things done.
On Wed, Mar 31, 2010 at 1:13 PM, John R Pierce <pierce(at)hogranch(dot)com> wrote:
> dipti shah wrote:
>
>> Thanks Guys. DBI works fine. I have written below code but it executes
>> only on the server where I installed postgresql. Is there any way to run
>> this code from remote host. I get an error when trying to run it from remote
>> host. I think it is obvious because in below code there is no information
>> where to connect to. Could you please help me out.
>>
>> use DBI;
>> $DB_name = 'mydb';
>> $DB_user = 'postgres';
>> $DB_pwd = '';
>> $dbh = DBI->connect("dbi:Pg:dbname=$DB_name","$DB_user","$DB_pwd");
>> ...
>>
>
> see http://search.cpan.org/~turnstep/DBD-Pg-2.16.1/Pg.pm#connect<http://search.cpan.org/%7Eturnstep/DBD-Pg-2.16.1/Pg.pm#connect><
> http://search.cpan.org/%7Eturnstep/DBD-Pg-2.16.1/Pg.pm#connect>
>
> add ;host=hostname-or-ip to the connect string...
>
From | Date | Subject | |
---|---|---|---|
Next Message | Guillaume Lelarge | 2010-03-31 08:30:00 | Re: User action accounting |
Previous Message | John R Pierce | 2010-03-31 07:43:50 | Re: Connect to postgresql database using Perl |
From | Date | Subject | |
---|---|---|---|
Next Message | Machiel Richards | 2010-03-31 09:15:18 | Daily checks help |
Previous Message | John R Pierce | 2010-03-31 07:43:50 | Re: Connect to postgresql database using Perl |