This is a mysql connection example: my $db_driver = "mysql"; my $db_name = "test"; my $db_host = "localhost"; --> for localhost mysql connection my $db_user = "test"; my $db_passwd = "password"; my $dbh = DBI->connect("DBI:$db_driver:$db_name:$db_host", $db_user, $db_passwd, { RaiseError => 1, AutoCommit => 0 }); Cheers, Francesco On Thu, 2006-04-27 at 17:39 +0200, gregor herrmann wrote: > On Thu, Apr 27, 2006 at 04:27:05PM +0100, Simon Waters wrote: > > > ---------------------------------------------------------------------------------------- > > #!/usr/bin/perl > > use strict; > > use warnings; > > use DBI; > > > > my > > $dbh=DBI->connect("dbi:Pg:dbname=dbname;host='mercury';port=5432;",,"dbuser","dbpass",); > > ---------------------------------------------------------------------------------------- > > > > think my server name is "8'@@" (or other random junk) on Debian Sarge > > installs (all of mine). > > > > ---------------------------------------------------------------------------------------- > > DBI connect('dbname=dbname;host='mercury';port=5432;','dbuser',...) > > failed: could not connect to server: 8?@@ > > Is the server running on host "mercury" and accepting > > TCP/IP connections on port 5432? > > at perl/con line 6 > > ---------------------------------------------------------------------------------------- > > The "8?@@" is not the hostname but the error message. Not that that's > more helpful ... > > JFTR: Testing your example on my machine (only changing the hostname, no PG > running, unstable) I get: > > DBI connect('dbname=dbname;host='belanna';port=5432;','dbuser',...) failed: could not connect to server: Connection refused > Is the server running on host "belanna" and accepting > TCP/IP connections on port 5432? > at ./test line 6 > > > gregor -- .''`. ** Debian GNU/Linux ** | Francesco Cecconi ' |BrAnD| ' : :' : The Universal O.S. | francesco.cecconi@gmail.com `. `'` | GPG Key ID: 11F6E468 `- *Debian Pkg Maintainer* | JID brand80@jabber.linux.it
Attachment:
signature.asc
Description: This is a digitally signed message part