4 messages in com.mysql.lists.javacommit() exceptions| From | Sent On | Attachments |
|---|---|---|
| Marc Dumontier | 08 Mar 2005 14:03 | |
| Marc Dumontier | 08 Mar 2005 14:20 | |
| Marc Slemko | 08 Mar 2005 17:05 | |
| Marc Dumontier | 09 Mar 2005 07:20 |
| Subject: | commit() exceptions![]() |
|---|---|
| From: | Marc Dumontier (mrdu...@blueprint.org) |
| Date: | 03/08/2005 02:03:31 PM |
| List: | com.mysql.lists.java |
Hi,
I have this program which basically imports alot of records into my database all in one transaction. It also backs up the old records if an update is being done into a seperate database, i basically start a transaction on both databases, and then commit or rollback at the end.
Here's the problem. Sometimes the large imports are all inserts so that the archive database never gets used. Then when i do the commit() it throws an SQLException. I think what is happening is that my connection is being dropped by the server (i have autoReconnect=true in my connection url), so that when i go to commit, it doesn't know of my transaction. I tried to check the auto commit flag on the conenction, but it looks like it's still false.
This happens each time, not sporatically.
Any help would be appreciated
the stack trace is
org.blueprint.common.db.EndTransactionException: java.sql.SQLException: Communication link failure: java.io.EOFException , underlying cause: null
** BEGIN NESTED EXCEPTION **
java.io.EOFException
STACKTRACE:
java.io.EOFException at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1319) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:1463) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1854) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1109) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1203) at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:1164) at com.mysql.jdbc.Connection.execSQL(Connection.java:2087) at com.mysql.jdbc.Connection.execSQL(Connection.java:2049) at com.mysql.jdbc.Connection.execSQL(Connection.java:2030) at com.mysql.jdbc.Connection.commit(Connection.java:1105) at org.blueprint.common.db.DbManager.endTransaction(DbManager.java:373) at Test.<init>(Test.java:28) at Test.main(Test.java:44)
here's some code snippets.
getBssDb().startTransaction(); getBrsDb().startTransaction();
reader.parse(new InputSource(new FileInputStream(riBean.getLocalFilePath())));
if(!getBssDb().getConnection().getAutoCommit()) { getBssDb().endTransaction(); } if(!getBrsDb().getConnection().getAutoCommit()) { getBrsDb().endTransaction(); }
public void startTransaction() throws StartTransactionException, DbNotConnectedException { if(!isConnected()) { throw new DbNotConnectedException(); }
try { connection.setAutoCommit(false); } catch(SQLException e) { throw new StartTransactionException(e); } }
public void endTransaction() throws EndTransactionException, DbNotConnectedException { if(!isConnected()) { throw new DbNotConnectedException(); }
try {
//No transaction set so return if(connection.getAutoCommit()) { throw new EndTransactionException("startTransaction has not been called"); }
connection.commit(); } catch (SQLException e) { this.rollBackTransaction(); throw new EndTransactionException(e); } }




