Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

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

  1. #1
    Junior Member
    Join Date
    Dec 2011
    Posts
    9
    My Mood
    Angelic
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    import java.io.*;
    import java.util.*;
    import java.sql.*;
    class empListCondition {
    @SuppressWarnings("deprecation")
    public static void main(String[] args)throws SQLException,IOException,ClassNotFoundException
    {
    DataInputStream dis=new DataInputStream(System.in);
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbcdbc:jeevan_db ","system","Passpass1");
    Statement st=con.createStatement();
    //------condition 1---------
    System.out.println("enter eno");
    int no=Integer.parseInt(dis.readLine());
    ResultSet rs=st.executeQuery("select ename,esal from emp where eno="+no);
    System.out.println("details are"+rs.getString("ename"));
    rs.close();
    st.close();
    con.close();

    }
    }
    ################################################## #
    this time i installed 11g R2 and connection got established and still following are the run time errors i am facing!!!
    ################################################## #
    my table is: create table emp(eno number(5),ename varchar2(10),esal number(10));
    ################################################## #
    i inserted : insert into emp values(1,'jeevan',100);
    insert into emp values(2,'jeevan1',1000);
    C:\Users\Wade\Desktop\javaprogs>java empListCondition
    enter eno
    2
    Exception in thread "main" java.sql.SQLException: [Microsoft][ODBC Driver Manage
    r] Invalid cursor state
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(Unkn own Source)
    at sun.jdbc.odbc.JdbcOdbcResultSet.getString(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcResultSet.getString(Unknown Source)
    at empListCondition.main(empListCondition.java:16)
    ################################################## #####
    god help me please guys


  2. #2
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

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

    Quote Originally Posted by jeevan reddy mandali View Post
    import java.io.*;
    import java.util.*;
    import java.sql.*;
    class empListCondition {
    @SuppressWarnings("deprecation")
    public static void main(String[] args)throws SQLException,IOException,ClassNotFoundException
    {
    DataInputStream dis=new DataInputStream(System.in);
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbcdbc:jeevan_db ","system","Passpass1");
    Statement st=con.createStatement();
    //------condition 1---------
    System.out.println("enter eno");
    int no=Integer.parseInt(dis.readLine());
    ResultSet rs=st.executeQuery("select ename,esal from emp where eno="+no);
    System.out.println("details are"+rs.getString("ename"));
    rs.close();
    st.close();
    con.close();

    }
    }
    ################################################## #
    this time i installed 11g R2 and connection got established and still following are the run time errors i am facing!!!
    ################################################## #
    my table is: create table emp(eno number(5),ename varchar2(10),esal number(10));
    ################################################## #
    i inserted : insert into emp values(1,'jeevan',100);
    insert into emp values(2,'jeevan1',1000);
    C:\Users\Wade\Desktop\javaprogs>java empListCondition
    enter eno
    2
    Exception in thread "main" java.sql.SQLException: [Microsoft][ODBC Driver Manage
    r] Invalid cursor state
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(Unkn own Source)
    at sun.jdbc.odbc.JdbcOdbcResultSet.getString(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcResultSet.getString(Unknown Source)
    at empListCondition.main(empListCondition.java:16)
    ################################################## #####
    god help me please guys
    1. Read the forums Rules.
    2. Don't use others threads to post your own problem.
    3. Create a new thread in specified category.

  3. #3
    Super Moderator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,233
    Thanks
    176
    Thanked 817 Times in 760 Posts
    Blog Entries
    5

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

    @jeevan reddy mandali
    to continue Mr.777 post:
    4) Do not hijack a thread that is over 3 years old...in fact, do not hijack anyone's thread for that matter. I have moved your thread to one if its own
    5) Do not send out PM's to people expecting specialized help from them. Doing so defeats the purpose of public forums, and further makes you appear as if your time is more valuable than anyone else's in the forums - and yes this can hurt your chances of receiving help.

Similar Threads

  1. Replies: 0
    Last Post: December 25th, 2011, 12:59 PM
  2. Replies: 2
    Last Post: November 17th, 2011, 07:03 AM
  3. Replies: 1
    Last Post: September 9th, 2011, 02:30 PM
  4. Cannot locate sun.jdbc.odbc.jbcOdbc driver
    By birdlover2010 in forum JDBC & Databases
    Replies: 7
    Last Post: November 6th, 2010, 02:57 PM
  5. Replies: 6
    Last Post: August 30th, 2009, 04:31 AM