Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Select statement blocking when run through JDBC/jTDS

843859Feb 15 2008 — edited Nov 20 2014
Hi,

I have a very simple statement that runs on a very large but indexed table on SQL Server 2000. If I simply run:

SELECT * FROM t1 WHERE x = 'y' and a = 'b'

... directly on the SQL Server Query analyser, or through various other API's (Coldfusion in this case) the results are returned in less than a second. However, when I implement the excact same query in JTDS as:

-----
String sql = "SELECT * FROM t1 WHERE x = ? and a = ?";
PreaparedStatement pstmt = con.prepareStatement(SQL);
pstmt.setString(1,"y");
pstmt.setString(2,"b");
ResultSet rs = pstmt.executeQuery();
-----

... this causes the query to block for a huge amount of time and make the database unusable until the process is killed.

Does anyone know what I'm missing here - from what I can see it's the same query so I dont understand why it only causes blocking when run through jTDS / JDBC

TIA
Craig
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 17 2008
Added on Feb 15 2008
8 comments
625 views