2

We have a problem with org.springframework.jdbc.datasource.SingleConnectionDataSource?

We expect that the connection is never closed while the application is running, even if there is no traffic between application and db.

We configured datasource with <property name="suppressClose" value="true"/> what should solve the problem.

And the problem is that the connection is closed after about 30-40 minutes of inactivity (when there is no traffic between db and application).

Maybe someone with experience with SingleConnectionDataSource can help how to solve this bug or feature.

Łukasz Rzeszotarski
  • 5,791
  • 6
  • 37
  • 68

1 Answers1

1

If underneath SimpleConnectionDataSource, a MySql connection is used, then it will usually be dropped after 30-40 minutes of inactivity. Even if you use straight JDBC and create connection via:

Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager
                 .getConnection("jdbc:mysql://localhost/mydatabase?user=username&password=pass");

It will also be dropped after 30-40 mins.

Dimitry K
  • 2,236
  • 1
  • 28
  • 37