wood burning stoves 2.0*
The moose likes JDBC and the fly likes DB2Exception on rs.next() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "DB2Exception on rs.next()" Watch "DB2Exception on rs.next()" New topic
Author

DB2Exception on rs.next()

Ted J Schrader
Greenhorn

Joined: Oct 10, 2001
Posts: 28
Hello,
I have stumbled on a very frustrating error that may be of interest to others. Note that this error only occurs every once in a while.
First, the error:
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0501N The cursor specified in a FETCH or CLOSE statement is not open. SQLSTATE=24501
Now, the old code:

As noted in the code, it bombs at rs.next(). On the database, the NTFTN_DT column is defined on DB2 as DATE.
Now, if I change

to

it will start to work.
I've been told that even this isn't the best way to do this; just hard-code CURRENT DATE in the SQL to ensure that we are getting database date instead of server date.
Hope this helps.
Ted Schrader, SCJ2P
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DB2Exception on rs.next()
 
Similar Threads
Please Point Out My Mistakes
Performence issue:Write query directly in session bean or call storted procedure
What is wrong?
newbie problem
Data lost when writing object to a file