This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes DB2Exception on Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "DB2Exception on" Watch "DB2Exception on" New topic

DB2Exception on

Ted J Schrader

Joined: Oct 10, 2001
Posts: 28
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: [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 On the database, the NTFTN_DT column is defined on DB2 as DATE.
Now, if I change


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:
subject: DB2Exception on
It's not a secret anymore!