db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Tilsted <til...@daimi.au.dk>
Subject Exception after my program sleep for 2 hours.
Date Tue, 10 Jun 2008 11:52:16 GMT
I have a java program that uses Torque and it is working fine with one 
exception.
My program might need to sleep for 2 hours, using Thread.sleep() but 
after it wake up again, torque always throws an exception when I try to call
doSelect(). Is there  anyway to avoid this?.  This program don't do any 
connection handling at all.

In an other program, i want to have all my queries running within a 
transaction. So i do a
Connection connection=Transaction.begin();
but is there any way to specify that this connection should be used as 
default for this thread, so that I don't have to pass the connection to all
the methods that might need it.

Martin

------- The exception I get is: -------

org.apache.torque.TorqueException: 
com.mysql.jdbc.CommunicationsException: Communications link failure due 
to underlying exception:

** BEGIN NESTED EXCEPTION **

java.io.EOFException
MESSAGE: Can not read response from server. Expected to read 4 bytes, 
read 0 bytes before connection was unexpectedly lost.

STACKTRACE:

java.io.EOFException: Can not read response from server. Expected to 
read 4 bytes, read 0 bytes before connection was unexpectedly lost.
        at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1997)
        at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2411)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2916)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
        at com.mysql.jdbc.Connection.execSQL(Connection.java:3277)
        at com.mysql.jdbc.Connection.setAutoCommit(Connection.java:5442)
        at 
org.apache.commons.dbcp.cpdsadapter.ConnectionImpl.setAutoCommit(ConnectionImpl.java:326)
        at 
org.apache.commons.dbcp.datasources.SharedPoolDataSource.setupDefaults(SharedPoolDataSource.java:227)
        at 
org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getConnection(InstanceKeyDataSource.java:692)
        at 
org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getConnection(InstanceKeyDataSource.java:653)
        at 
org.apache.torque.TorqueInstance.getConnection(TorqueInstance.java:912)
        at org.apache.torque.Torque.getConnection(Torque.java:314)
        at 
org.apache.torque.util.Transaction.beginOptional(Transaction.java:108)
        at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:753)
        at 
wave.auto.BaseBlogPeer.doSelectVillageRecords(BaseBlogPeer.java:432)
        at 
wave.auto.BaseBlogPeer.doSelectVillageRecords(BaseBlogPeer.java:405)
        at wave.auto.BaseBlogPeer.doSelect(BaseBlogPeer.java:373)
        at wave.admin.Daemon.main(Daemon.java:37)


    Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message