Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented

后端 未结 7 780
时光说笑
时光说笑 2020-12-06 03:42

I am trying to configure dbcp2 with postgres 9.1

When I run my app, it throws exception:

Exception in thread \"main\" org.springframework.jdbc.Cannot         


        
7条回答
  •  猫巷女王i
    2020-12-06 04:38

    That method is implemented in the current driver version. You must be using an old PgJDBC. Upgrade. It's fully backward compatible. (You should've specified your PgJDBC version in the question).

    Separately, though, relying on connection "validation" is usually a bad idea. It's just a way of trying to imperfectly hide a race condition. Simply grab the connection and use it. If there's a problem with it, your application should trap the resulting exception, check the SQLSTATE to see if it's a connection related error, and retry with a new connection.

提交回复
热议问题