Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state

Reply
Thread Tools

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

 
 
guptapr guptapr is offline
Junior Member
Join Date: Aug 2009
Posts: 1
 
      08-28-2009
I am getting an exception (java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state)
while running this program given below. Please help.


import java.sql.*;
import java.io.*;

class Dbconnect1
{
public static void main(String[] args)
{
String str[]={"Yahoo","Yah"};
int count=0;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbcdbc:db");

String query="Select distinct id from employee";
Statement st=con.createStatement(ResultSet.TYPE_SCROLL_SENSI TIVE,ResultSet.CONCUR_UPDATABLE);
ResultSet rs = st.executeQuery(query);

rs.beforeFirst();
while(rs.next())
{
System.out.println(rs.getInt(1));
}
st.close();
con.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
i am getting the exception at line:

System.out.println(rs.getInt(1));

output is
1
2
3
4
5
6
7
8
9
10
11
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLGetDataInteger(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcResultSet.getDataInteger(Unk nown Source)
at sun.jdbc.odbc.JdbcOdbcResultSet.getInt(Unknown Source)
at Dbconnect1.main(Dbconnect1.java:29)
 

Last edited by guptapr; 08-28-2009 at 12:39 PM..
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error :"Invalid Cursor State" dhavalthakor28691 Java 0 06-29-2011 07:59 AM
how to tell if cursor is sqlite.Cursor or psycopg2.Cursor dmaziuk Python 3 01-25-2011 04:52 AM
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x8fc Thread 0x934 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 1 03-24-2006 04:20 PM
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x8fc Thread 0x934 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 0 03-24-2006 02:22 PM
Invalid cursor state - Am I completely stupid? Kyle Java 7 01-21-2005 03:16 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57