georgetovrea
georgetovrea

Reputation: 577

Perl Debugger: DBD::mysql::db do failed: MySQL server has gone away at

I use MySQL with the DBI Module for my perl programming database connections. I got the error message as below when using mysql :

Issuing rollback() due to DESTROY without explicit disconnect() of       
DBD::mysql::db handle db=db;ip=X.X.X.X; at /code/save2db.plx line 104.
DBD::mysql::db DESTROY failed: MySQL server has gone away at   
/code/save2db.plx line 104.
    (in cleanup) DBD::mysql::db DESTROY failed: MySQL server has gone away  
at /code/save2db.plx line 104.

the line 104 in my code is

103    $dbh->disconnect;
104    exit;

Any idea why this happens? I'd appreciate any feedback.

Upvotes: 1

Views: 2065

Answers (1)

pii_ke
pii_ke

Reputation: 2891

The transaction behaviour of the disconnect method is, sadly, undefined. Some database systems (such as Oracle and Ingres) will automatically commit any outstanding changes, but others (such as Informix) will rollback any outstanding changes. Applications not using AutoCommit should explicitly call commit or rollback before calling disconnect.

See https://metacpan.org/pod/DBI#disconnect

Upvotes: 1

Related Questions