cancel
Showing results for 
Search instead for 
Did you mean: 

Connection closed after query runs past two hours

1,436

Hello,

I am using Sybase Anywhere 12 with a java application. I connect to the db with jdbcTemplate and am using jconn4.

I initially thought the issue was with the Idle connection parameter (even though it is set by default to 240 min). However I noticed in the documentation that Usage: "Anywhere except with TDS connections. TDS connections (including jConnect) ignore the SQL Anywhere Idle connection parameter."

Why is my connection consistently dying after two hours and how do I modify the IDLE time for a TDS connection?

Thanks.

Accepted Solutions (0)

Answers (1)

Answers (1)

Breck_Carter
Participant

Sometimes you need a law degree to understand the documentation... fortunately, I once stayed at a Holiday Inn Express so we're all set!

Connection parameters are used to set connection properties, and what you may be dealing with is a server property...

SELECT @@VERSION,
       PROPERTY ( 'IdleTimeout' ) AS "Server Connection Idle Timeout", 
       CONNECTION_PROPERTY ( 'IdleTimeout' ) AS "Connection Connection Idle Timeout"

@@VERSION,Server Connection Idle Timeout,Connection Connection Idle Timeout
'12.0.1.4231','240','0'

Consider using dbsrv12 -ti 0

SELECT @@VERSION,
       PROPERTY ( 'IdleTimeout' ) AS "Server Connection Idle Timeout", 
       CONNECTION_PROPERTY ( 'IdleTimeout' ) AS "Connection Connection Idle Timeout"

@@VERSION,Server Connection Idle Timeout,Connection Connection Idle Timeout
'12.0.1.4231','0','0'
VolkerBarth
Contributor
0 Kudos

Just to add: You might also check whether liveness timeout (LTO) checking leads to closed connections. When debugging long running applications (say, batch imports), I usually add LTO=0 to the connection string in order to prevent the connection to be closed by the database server in case the program is paused by a breakpoint or the like...

To clarify: That is different from idle timeout checking, and the latter is certainly relevant in your case because of the 240 minute default.