Two Laptop Bag*
The moose likes JDBC and the fly likes No Current Row in the ResultSet when Migrating from SQL 2000 to 2005 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "No Current Row in the ResultSet when Migrating from SQL 2000 to 2005" Watch "No Current Row in the ResultSet when Migrating from SQL 2000 to 2005" New topic
Author

No Current Row in the ResultSet when Migrating from SQL 2000 to 2005

Scott Florez
Ranch Hand

Joined: Dec 05, 2006
Posts: 58
We are in the process of migrating from a SQL 2000 server to a SQL 2005 server. I have a Java application that was working flawlessly when driven by the SQL 2000 server, but is throwing a "No Current Row in the ResultSet" SQL Exception when using the SQL 2005 server. The SQL 2005 server seems to interact properly with the application for the most part, but I am consistently getting this exception when my application runs a follow-up query after the initial query.

I have looked over the database and tables on the SQL 2005 server, and as far as I can tell, they all look the same as on the SQL 2000 server. However, I really don't know a whole lot about Microsoft SQL Server.

I could post a bunch of code here, but since the problem only is present with the SQL 2005 server, I figure the problem likely isn't with my code. I'm using the jTDS SQL driver with this application. Does anyone have any ideas?
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30789
    
157

Scott,
It sounds like the driver fixed something in the later version. Are you sharing connection/statement objects between the queries? Do you close all resources in a finally block?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Scott Florez
Ranch Hand

Joined: Dec 05, 2006
Posts: 58
Originally posted by Jeanne Boyarsky:
Scott,
It sounds like the driver fixed something in the later version. Are you sharing connection/statement objects between the queries? Do you close all resources in a finally block?


I'm not sharing connection/statement objects, but I don't use a finally block to close the resources. I do it in the try block. Does that make a difference? I can try a finally block.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

The difference is the code in the try block may not be run, whereas the code in the finally block will. Its safer to release JDBC resources in a finally block.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Scott Florez
Ranch Hand

Joined: Dec 05, 2006
Posts: 58
UPDATE:

Closing the connections in a finally block didn't fix my problem. Also, I thought that the exception was only occurring when I did a second "follow-up" query, but it's now occasionally doing it on the initial query. There doesn't seem to be any common factor between queries that cause the exception. To make it worse, sometimes a certain query will work and sometimes the exact same query causes an exception. If it were possible, I'd just stick with the SQL 2000 server, but my agency has other plans for that server. You know what they say: if it ain't broke...
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10240
    
168

I'm using the jTDS SQL driver with this application.


Not sure if this would help, but you could try using the Microsoft JDBC Driver for SQL Server 2005


[My Blog] [JavaRanch Journal]
Herman Schelti
Ranch Hand

Joined: Jul 17, 2006
Posts: 387
hi Scott,

you could also post an example of the code that sometimes runs fine and sometimes gives you this exception.


Herman
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: No Current Row in the ResultSet when Migrating from SQL 2000 to 2005