cancel
Showing results for 
Search instead for 
Did you mean: 

jconn driver not respecting connection properties

0 Kudos

We are using jconn4.jar to connect to Sybase server using java code. The problem is that sometimes when reading/writing data to the Sybase server, the server hangs which keeps the connection that was made to the server open. We are checking using sp_who and select * from master..sysprocesses.

This is a scenario that is reproducible on a server that is not accessible to us and we are not able to reproduce on the Sybase server that we have with us. To try to mitigate this issue we used DEFAULT_QUERY_ TIMEOUT connection property in the url(jdbc:sybase:Tds:XXX.XXX.XXX.XXXX:X?DEFAULT_QUERY_ TIMEOUT=10). Unfortunately this property is not respected by the driver and may be an issue with the driver. We have used two driver versions (jConnect (TM) for JDBC(TM)/7.00(Build 26502)/P/EBF17993/JDK16/Thu Jun 3 3:09:09 2010 and jConnect (TM) for JDBC(TM)/7.07 SP140 (Build 27377)/P/EBF28026/JDK 1.6.0/jdbcmain/OPT/Thu Apr 26 00:07:49 PDT 2018) but both do not seem to respect the connection properties that we provide from url.

Is this known behaviour? Is there any documentation where we can find all the jconn jar that have been released and known bugs fixed?

0 Kudos

Any pointers on this ?

Accepted Solutions (0)

Answers (2)

Answers (2)

kaus19d
Active Contributor
0 Kudos

try installing with new ASE client patch. also please check the DB env values of PAS server

ryan_hansen
Contributor
0 Kudos

Hi,

I was not able to see a timeout exception until I added a ResultSet structure.
I'm not able to see an issue with the timeout though.

Test code:
import java.sql.*;
import java.io.*;
import java.util.*;
public class Test{ public static void main ( String [] arg ) {
try { Class.forName( "com.sybase.jdbc4.jdbc.SybDriver" ).newInstance();
//INTERNAL_QUERY_TIMEOUT=5&DEFAULT_QUERY_TIMEOUT=5
Connection con = DriverManager.getConnection("jdbc:sybase:Tds:host:port/database?dynamic_prepare=false&INTERNAL_QUERY_TIMEOUT=5&DEFAULT_QUERY_TIMEOUT=5","user","password");
Statement stmt = con.createStatement();
//can set it in java as well
//stmt.setQueryTimeout(5);
//no exception
//stmt.executeQuery("select * from largealloc");
//exception ResultSet rs = stmt.executeQuery("select * from largealloc");
int i = 1;
while (rs.next()) { System.out.println("Row: " + i);
System.out.println("ID: " + rs.getString(1).trim());
System.out.println(" ");
i = i + 1;
}
rs.close();
stmt.close();
con.close();
}
catch ( Exception e ) { e.printStackTrace(); } finally { } } }


Do you have issues running this?

Regards,
Ryan