I asked this on comp.lang.perl.modules but I thought someone here might have an idea as well: I have some code that does this:
use DBI; my $dbh = DBI->connect('dbi:mysql:database=mysql;host=localhost', $username, $password); $dbh->func('createdb', $newdb, 'admin'); (BTW, what is the 'admin' argument for? The man page doesn't say...) In my real code all of these check for error returns and display messages; they both succeed. This works, but after the createdb operation the DB handle ($dbh) seems to be destroyed! Or, at least the connection is lost. The next time I try to use the handle after this createdb function succeeds I get an error; for example: $dbh->do("CREATE TABLE $newdb.mytable (...)") or die $DBI::errstr; Generates this error message: MySQL server has gone away and the table is not created. The second time I run this script, which skips the createdb since it was created last time, it goes through and creates the table just fine with no errors. Does anyone have any ideas about what's going on here? Do I really have to reconnect to the DB every time I create or drop a new database (even databases which aren't my currently selected database)? Perl 5.6.1, with DBI version 1.18 and DBD::mysql version 2.0416. MySQL version 3.23.36 on a Debian GNU/Linux testing/woody box. -- ------------------------------------------------------------------------------- Paul D. Smith <[EMAIL PROTECTED]> HASMAT--HA Software Mthds & Tools "Please remain calm...I may be mad, but I am a professional." --Mad Scientist ------------------------------------------------------------------------------- These are my opinions---Nortel Networks takes no responsibility for them. --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php