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

Discussion in 'Java' started by guptapr, Aug 28, 2009.

  1. guptapr

    guptapr

    Joined:
    Aug 28, 2009
    Messages:
    1
    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("jdbc:eek:dbc:db");

    String query="Select distinct id from employee";
    Statement st=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,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(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcResultSet.getInt(Unknown Source)
    at Dbconnect1.main(Dbconnect1.java:29)
     
    Last edited: Aug 28, 2009
    guptapr, Aug 28, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UmV6YSBOYWJp?=

    ERROR: [ODBC Microsoft Access Driver]Invalid precision value

    =?Utf-8?B?UmV6YSBOYWJp?=, Sep 8, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    6,659
    Paul Clement
    Sep 9, 2005
  2. jwtulp@hotmail.com
    Replies:
    0
    Views:
    3,581
    jwtulp@hotmail.com
    Jan 1, 2006
  3. Kermit Piper
    Replies:
    0
    Views:
    720
    Kermit Piper
    Jun 11, 2006
  4. Kermit Piper
    Replies:
    1
    Views:
    598
    Chris Uppal
    Jun 13, 2006
  5. Mariano Fernandao

    [Microsoft][ODBC Visual FoxPro Driver]Cannot update the cursor.

    Mariano Fernandao, Dec 10, 2003, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    397
    Mariano Fernandao
    Dec 10, 2003
Loading...

Share This Page