* [EMAIL PROTECTED] ([EMAIL PROTECTED]) [010531 12:05]:
> Hi all!
> 
> What is wrong in the fallowing code:
> 
> my($dsn)="DBI:Pg:base_name:localhost";
> 
> my($user_name)="postgres";
> my($password)="";
> my($dbh,$sth);
> 
> $dbh=DBI->connect($dsn,$user_name,$password,{RaiseError=>});

>From 'perldoc DBD::Pg'

----------------------------------------

       DBI Class Methods


       connect
           To connect to a database with a minimum of parameters,
           use the following syntax:

              $dbh = DBI->connect("dbi:Pg:dbname=$dbname", "", "");

           This connects to the database $dbname at localhost
           without any user authentication. This is sufficient
           for the defaults of PostgreSQL.

           The following connect statement shows all possible
           parameters:

             $dbh = 
DBI->connect("dbi:Pg:dbname=$dbname;host=$host;port=$port;options=$options;tty=$tty", 
"$username", "$password");

----------------------------------------

So you'd want to modify $dsn:

 my( $dsn ) = "DBI:Pg:dbname=base_name";

since 'localhost' is the default, you don't need to specify it.

Chris

-- 
Chris Winters ([EMAIL PROTECTED])
Building enterprise-capable snack solutions since 1988.

Reply via email to