473,511 Members | 16,849 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

The cursor specified in a FETCH or CLOSE statement is not open SQL Excep

I' m sending query to DB2 7.2 (installed on Win 2000) using JDBC driver
COM.ibm.db2.jdbc.net.DB2Driver like this:

String query = "SELECT dercert from vacert "
+ "WHERE vrijediod=(select max(vrijediod) from vacert where
vrijediod<?)";

java.sql.Timestamp timeStamp = new
java.sql.Timestamp(System.currentTimeMillis());

Connection cc = DriverManager.getConnection(url, user, psw);

PreparedStatement statement = connection.prepareStatement(sql);
fillStatement(statement, params);
ResultSet resultSet = statement.executeQuery();
if (!resultSet.next()) {
return null;
}

And I get SQL exception on resultSet.next().
SQL exception is:
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

What is the problem?

Driver url, username and password are OK.

Alan

Nov 12 '05 #1
1 4137
I made an error while copying text.
cc has to be connection.

fillStatement is method that sets timestamp into prepared statement
(setTimestamp() method is calles on prepared statement).

Does anyone knows answer to this problem.

Thanx.
Alan

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2414
by: Mike Austin | last post by:
It's the most annoying thing, and causes hours of frustration. Why can't it be resolved? Regards, Mike Austin Example: #include <iostream> #include <string>
2
1300
by: Joachim | last post by:
1. I am sure there is a way to close the ChildForm from ParentForm Example I have several (song) albums. Each album has several songs So.... Album is my ParentForm and each song has each...
5
11167
by: Ryan Liu | last post by:
Hi, Both way works, I'd just ask some experts which way is better? My application creates a log file daily. Now each time when I write a log, I will open the file and append to the end....
14
1380
dmjpro
by: dmjpro | last post by:
look at this code carefullyyyy ..... i mean when the method calling finished then the local reference l_stmt will be destroyed then will JVM close all resources associated with it .... plz...
2
13433
by: juan.gautier | last post by:
Hi, I try to construct a SQL code for a view to select a specific data from a table, this query take the value of the filter from a text box in a visual basic 6.0 form. my problem is when i...
2
1613
by: Sally1053 | last post by:
can you please give me an example of using the FETCH and cursor statement And make to be able to fetch more that one row at a time, lets say the two database are TEST(fetch to) and TLC (fetch...
9
19138
by: BhanteU | last post by:
I have written code to close all open reports, or close all forms (except a couple), using code similar to the following: While Application.Reports.Count > 0 DoCmd.Close acReport,...
1
3361
by: Sally Madeira | last post by:
I have a a Procedure that invokes another procedure that returns a cursor. When I get to the FETCH Statement I get the following Error: ORA-24338: statement handle not executed ORA-06512: at...
0
7355
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7510
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5066
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3225
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3213
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1576
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
781
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
447
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.