Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Scott Florez
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34837
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Scott Florez
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Scott Florez
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Herman Schelti
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Scott,

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


Herman
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic