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