1

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.

0

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

but in my script , I have add $dbh->do("COMMIT") or die "$dbh->errstr"; before disconnect
can you try using begin_work, commit and rollback methods for transaction management, instead of doing them with raw SQL?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.