• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

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

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
author & internet detective
Posts: 42056
926
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
What a show! What atmosphere! What fun! What a tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic