in reply to Centralized DSN Switch Script (MySQL)

I put together this test script and also put in a print in the central script to print the FILENAME. Here's the test script, located in "/home/sites-dev/home/dbtest.pl":
#!/usr/bin/perl use DBI; $database = "qsrsubs"; require '/home/sites/jdb.cgi'; print "DBH = $dbh\n"; print "DSN = $dsn\n"; $cmd = "show variables"; $sth = $dbh->prepare($cmd); $sth->execute(); while (@ary = $sth->fetchrow_array) { print "PORT = $ary[1]\n" if grep(/port/, @ary); }
And here's the output:

{jason@www home}$ /home/sites-dev/home/dbtest.pl
FILENAME = /home/sites-dev/home/dbtest.pl
DBH = DBI::db=HASH(0x816603c)
DSN = DBI:mysql:database=qsrsubs;port=3308
PORT = 3306

arg - this baffles me!

Jason

Replies are listed 'Best First'.
Re: Re: Centralized DSN Switch Script (MySQL)
by Anonymous Monk on Nov 02, 2001 at 12:26 UTC
    Baffling indeed. But searching Google Groups revealed the following: http://groups.google.com/groups?hl=en&selm=87s85a%2419c5%241%40FreeBSD.csie.NCTU.edu.tw

    So maybe $dsn = "DBI:mysql:database=$database;host=127.0.0.1;port=3308"; will bring you luck...

      Oops, I forgot to log in to post that previous reply -- If the proposed solution works, I'll gladly take karma points on this post ;-)