實作Connection Pooling
http://dev.mysql.com/tech-resources/articles/connection_pooling_with_connectorj.html
如何避免連線數過多 refer to
http://stackoverflow.com/questions/2193603/how-to-overcome-java-sql-sqlexception-too-many-connections-exception
- Yes you should close your
Statement
s /ResultSet
s - These will typically reference the raw JDBCConnection
rather than thePooledConnection
proxyConnection
returned by the DBCPPooledDataSource
. - Consider using C3P0 rather than DBCP.
- Consider using Spring to manage your JDBC operations and you will never have to worry about this kind of thing.
沒有留言:
張貼留言
留個話吧:)