Basics - Troubleshooting Hibernate / JDBC Connection Pool Issue

后端 未结 6 2085
Happy的楠姐
Happy的楠姐 2021-02-13 05:39

What is Hibernate\'s responsibility in regards to database connections it gets from an underlying connection pool. Does it test to see if a connection is closed before it uses i

6条回答
  •  礼貌的吻别
    2021-02-13 06:27

    What is Hibernate's responsibility in regards to database connections it gets from an underlying connection pool.

    Not much, releasing it when the Session gets closed.

    Does it test to see if a connection is closed before it uses it? and if so get another connection from the pool?

    No, Hibernate doesn't, checking the validity of connection(s) is the responsibility of a connection pool if you want to.

    I've included error and confirmation info below. Any ideas of where I can start to troubleshoot this would be very helpful.

    What kind of process are you running exactly? A long transaction? Does it timeout? What does the Caused by: say? About the trace:

    2010-11-04 21:54:52,705 [tomcat-http--18] WARN util.JDBCExceptionReporter - SQL Error: 0, SQLState: 08S01 
    2010-11-04 21:54:52,707 [tomcat-http--18] ERROR util.JDBCExceptionReporter - Socket closed
    2010-11-04 21:54:52,708 [tomcat-http--18] ERROR transaction.JDBCTransaction - JDBC rollback failed java.sql.SQLException: Connection has already been closed.
    

    Can you reproduce it in a deterministic way? Any networking problem?

    And any advice on the SQL Server driver settings we are using.

    I've added a great resource about Tomcat and connection pool configuration below. Not specific to SQL Server though.

    Resources

    • Configuring jdbc-pool for high-concurrency

提交回复
热议问题