aspose file tools*
The moose likes JDBC and the fly likes Too many connections Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Too many connections" Watch "Too many connections" New topic
Author

Too many connections

Santhosh Reddy
Greenhorn

Joined: Sep 25, 2006
Posts: 27
Anyone please tell me the possible problem in getting the below mentioned error


Environment: Tomcat5.5 Mysql 5.0 Ibatis
com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: Too many connections
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:921)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:812)
at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3269)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1182)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2644)
at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
at java.sql.DriverManager.getConnection(DriverManager.java:525)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at com.ibatis.common.jdbc.SimpleDataSource.popConnection(SimpleDataSource.java:580)
at com.ibatis.common.jdbc.SimpleDataSource.getConnection(SimpleDataSource.java:222)
at com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.init(JdbcTransaction.java:48)
at com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.getConnection(JdbcTransaction.java:89)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(GeneralStatement.java:104)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:565)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:540)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:84
[ March 10, 2008: Message edited by: Santhosh Reddy ]
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
Are you closing the connection after usage?


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Santhosh Reddy
Greenhorn

Joined: Sep 25, 2006
Posts: 27
Originally posted by Roger Chung-Wee:
Are you closing the connection after usage?


Connection closing is not required as i'm using iBATIS
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
Failure to close connections causes lots of problems, regardless of whether or not you are using a mapping framework.
Suraj Berwal
Greenhorn

Joined: Dec 28, 2001
Posts: 26
Originally posted by Santhosh Reddy:


Connection closing is not required as i'm using iBATIS


Check whether iBATIS is closing the unused connections.

I feel you will have to explicitly close connections using iBATIS when they are not in use.

It seems iBATIS is opening up lot of new connections without disposing existing unused connections.

Thanks,
Suraj


Suraj Berwal
Sun Certified Programmer for Java 2 Platform
Santhosh Reddy
Greenhorn

Joined: Sep 25, 2006
Posts: 27
we dont get any connection directly, we get only the sqlmaps,is it required to make the sqlmap reference to null.
Suraj Berwal
Greenhorn

Joined: Dec 28, 2001
Posts: 26
You will have to consult the iBATIS documentation/manual for that. I am sorry I haven't worked on iBATIS so exact mechanism is not known to me.

Suraj
 
Don't get me started about those stupid light bulbs.
 
subject: Too many connections