Le ven 27/08/2004 � 00:37, Yannick Warnier a �crit :
> Hi there,
>
> I'm having a problem with MySQL within a Perl::DBI usage. I've turned it
> upside-down and cannot find what it's related to.
>
> My Perl script creates multiple databases and populates them with
> tables. The problem appears when creating the second database (in the
> foreach statement):
>
> #
> # Get a database connection to use to create new databases
> #
> my $tempDSN = 'DBI:mysql:database=test:host=localhost';
> our $tempDBH =&DBI->connect($tempDSN,$login,$password)
> || die "Could not connect to test database: $! ";
>
> #
> # Go through a list of databases and create them one by one
> #
> foreach my $db ( keys(%$list_of_DBs) ) {
>
> #
> # Create a DB with the handler we have
> #
> my $create = $tempDBH->func('createdb',$db,'admin')
> ||die "Could not create database $db : $!";
>
> #
> # Connect to the newly created database
> #
> my $dbDSN = "DBI:mysql:database=$db:host=localhost";
> my $dbDBH = DBI->connect($dbDSN,$login,$password)
> || die "Could not connect to database $db : $!";
>
> #
> # Create a set of tables in this database
> #
> foreach my $table ( keys(%$list_of_tables) ) {
> $dbDBH->do("CREATE TABLE ... ");
> }
>
> #
> # Disconnect from the newly created database
> #
> $dbDBH->disconnect() || die "...";
> }
> #
> # Disconnect from the temporary database connection
> #
> $tempDBH->disconnect();
>
>
> So the first database is created with all it's table, but when I get to
> the second, I get this error:
> "Could not create database ..."
> And when asking more detail with $DBI::errstr:
> "ERROR: 2006 'MySQL server has gone away'"
>
> I've really searched this down in my doc, on the net, and with
> DBI->trace(5) but the only thing I figured out is that somehow the
> temporary database connection is shut down by something without asking.
>
> But I'm not sure... How could I?
>
> Anyway, if somebody has any idea what this might come from or has come
> to something similar in the past, please give me a hint.
I've taken another path and decided to "execute" mysqladmin to create my
databases.
I find it awful but it works, so...
Thanks anyway,
Yannick
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]