On Fri, 23 Apr 1999, Bill Rhodes wrote:
> I have a small problem connecting to a mysql database using perl scripts
> and the DBI module. When I try to issue a DBI->connect() from within the
> script, I get an error (it's below). I think the problem is that my mysql
> $dsn = "DBI:mysql:$database";
>
> $dbh = DBI->connect ($dsn,$user,$pass,'');
I wrote a script a few days ago for basically the same purpose
as you. I just compared it to the lines above, and there is a
small difference. Here's what I have:
$dsn = "DBI:$driver:database=$database";
$dbh = DBI->connect($dsn, $user, $password);
In the first line, $driver = "mysql" and $database =
the database name, and I think you can figure out
the second line. I'm new to this MySQL/DBI/CGI stuff
too, so I'm not sure if it makes any difference. You
might try putting in the "database=" part and see if
that works.
HTH,
Jeremy
-------------------------------------------------------
To automatically retrieve my PGP key via e-mail, send a
blank message with the subject line "fetch pgp key".