A
Al Reynolds
Hello,
I hope someone will be able to help me with this.
I am trying to set up a connection to my MySQL
database using perl. I already have the database
set up and have used it with PHP without any problems.
When I try and execute the following code, I get an error:
(obviously I have substituted the names/passwords)
#!/usr/bin/perl
use DBI;
my $dbh =
DBI->connect('DBI:mysql:databasename:localhost','username','password');
$dbh->disconnect or warn "Disconnection error: $DBI::errstr\n";
exit;
I contacted the service provider and they replied:
"Using this code, are you trying to create a dsn-less
(adodb) connection, as opposed to dsn (odbc), because
only the former is supported on our hosting packages?"
I think I understand from what I have read so far that I
am currently trying to create a dsn connection, but I might
well be completely wrong about that! Does what the ISP
said make sense?
Can I use DBI to create a dsn-less (ADODB) connection,
or do I need to use something completely different?
IN ASP, I would need to use CreateObject('ADODB.Connection')
Is there something similar I can use in Perl?
The perl version is 5.00503
DB_File, CGI, DBI and DBD-Mysql modules are installed.
Server software is:
Apache/1.3.20 Sun Cobalt (Unix) Chili!Soft-ASP/3.6.2
mod_ssl/2.8.4 OpenSSL/0.9.6b PHP/4.1.2
mod_auth_pam_external/0.1 FrontPage/4.0.4.3 mod_perl/1.25
Thanks in advance,
Al Reynolds
I hope someone will be able to help me with this.
I am trying to set up a connection to my MySQL
database using perl. I already have the database
set up and have used it with PHP without any problems.
When I try and execute the following code, I get an error:
(obviously I have substituted the names/passwords)
#!/usr/bin/perl
use DBI;
my $dbh =
DBI->connect('DBI:mysql:databasename:localhost','username','password');
$dbh->disconnect or warn "Disconnection error: $DBI::errstr\n";
exit;
I contacted the service provider and they replied:
"Using this code, are you trying to create a dsn-less
(adodb) connection, as opposed to dsn (odbc), because
only the former is supported on our hosting packages?"
I think I understand from what I have read so far that I
am currently trying to create a dsn connection, but I might
well be completely wrong about that! Does what the ISP
said make sense?
Can I use DBI to create a dsn-less (ADODB) connection,
or do I need to use something completely different?
IN ASP, I would need to use CreateObject('ADODB.Connection')
Is there something similar I can use in Perl?
The perl version is 5.00503
DB_File, CGI, DBI and DBD-Mysql modules are installed.
Server software is:
Apache/1.3.20 Sun Cobalt (Unix) Chili!Soft-ASP/3.6.2
mod_ssl/2.8.4 OpenSSL/0.9.6b PHP/4.1.2
mod_auth_pam_external/0.1 FrontPage/4.0.4.3 mod_perl/1.25
Thanks in advance,
Al Reynolds