db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Kucera" <mkuc...@bbm.ca>
Subject RE: MySQL: Unexpected end of input stream
Date Thu, 04 Dec 2003 21:54:29 GMT
Just to reply to my own message, I figured out this problem. MySQL likes
to close idle connections after 8 hours. To fix the problem I put
autoReconnect=true at the end of the db url.

torque.dsfactory.blah.connection.url =
jdbc:mysql://localhost/blah?autoReconnect=true

I havn't had any problems since doing this.



-----Original Message-----
From: Michael Kucera 
Sent: Thursday, November 27, 2003 10:54 AM
To: Apache Torque Users List
Subject: MySQL: Unexpected end of input stream


Hi,
 
I'm hoping that someone might have some insight into a problem I am
having. I am using Torque with MySQL and everything has been working
great until now. I have a demo version of my app running on a server.
After the app has been idle for a long time (several hours) it will
generate an error on a database access (select). If the database access
is attempted a second time it works.
 
Here is a piece of the stack trace:
 
java.io.IOException: Unexpected end of input stream
        at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:1405)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1775)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1020)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1109)
        at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:1070)
        at com.mysql.jdbc.Connection.execSQL(Connection.java:2027)
        at com.mysql.jdbc.Connection.execSQL(Connection.java:1996)
        at com.mysql.jdbc.Connection.execSQL(Connection.java:1977)
        at com.mysql.jdbc.Connection.setAutoCommit(Connection.java:654)
        at
org.apache.commons.dbcp.cpdsadapter.ConnectionImpl.setAutoCommit(Connect
ionImpl.java:370)
        at
org.apache.commons.dbcp.datasources.SharedPoolDataSource.setupDefaults(S
haredPoolDataSource.java:258)
        at
org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getConnection(
InstanceKeyDataSource.java:704)
        at
org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getConnection(
InstanceKeyDataSource.java:665)
        at
org.apache.torque.TorqueInstance.getConnection(TorqueInstance.java:743)
        at org.apache.torque.Torque.getConnection(Torque.java:306)
        at
org.apache.torque.util.Transaction.beginOptional(Transaction.java:118)
        at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1365)

Here is a sample of my Torque.properties
 
torque.database.default=db
torque.database.db.adapter=mysql
torque.dsfactory.db.factory=org.apache.torque.dsfactory.SharedPoolDataSo
urceFactory
torque.dsfactory.db.pool.defaultMaxActive=10
torque.dsfactory.db.pool.testOnBorrow=true
torque.dsfactory.db.pool.validationQuery=SELECT 1
torque.dsfactory.db.connection.driver = com.mysql.jdbc.Driver
torque.dsfactory.db.connection.url = jdbc:mysql://localhost/blah
torque.dsfactory.db.connection.user = blah
torque.dsfactory.db.connection.password = 
 
 
I think MySQL is closing idle connections and Torque dosen't like it.
Has anyone else had this problem? Should I try using a different pool?
If so which pool? Is there something wrong with my config? 
 
I could always write code that catches the first exception and then
makes a second attempt but that seems hacky and dosen't get at the heart
of the problem.
 
Any help is greatly appreciated. Thanks!!!
 
 
Michael Kucera
Programmer/Analyst
BBM Canada
mkucera@bbm.ca <mailto:mkucera@bbm.ca> 
 
 

---------------------------------------------------------------------
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