Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor stat

843854Jan 16 2004 — edited May 7 2006
Hello All,

I am facing a very simple but major problem...

when i am trying to fetch the max(id) from a employee table it is giving me
.Invalid Cursor State Error .The part of the code which is giving error is:

str="select isnull(max(id),0) from Employee";
rs=st.executeQuery(str);
rs.next();
int id=rs.getInt(1);
rs.close();

I'm using a bean to connect to a database, in this case SQL Server 7 . And all other programs work fine in the application , apart from this so their is no problem with the bean.
I had not used while because ResultSet will contain only one record.
Please, provide ur valuable suggestion.
thanx in advance
Shaman

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 4 2006
Added on Jan 16 2004
11 comments
263 views