Hai all, when i try to use the beforeFirst function i get the following error. Request to all to help me where to correct my program. thanx prabhakar. ----------------------------------------------------- java.sql.SQLException: Invalid operation for forward only resultset : beforeFirst at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java) at oracle.jdbc.driver.BaseResultSet.beforeFirst(BaseResultSet.java) at dbtest1.main(dbtest1.java:26) -------------------------------------------------------- import java.io.*; import java.util.*; import java.sql.*; public class dbtest1 { public static void main(String args[]) { Connection con; try{ Class.forName("oracle.jdbc.driver.OracleDriver"); } catch(Exception e) { System.out.println(" ERROR: While Getting Connection with the First Database"); e.printStackTrace(); } try { con = DriverManager.getConnection("jdbc racle:thin:@202.141.81.233:1521:PROJDB","scott","tiger"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select * from emp");
What it's saying is that you can only move forward in your resultset. If you are using JDBC 2.0 and above API, you need to specify constants if you want to move in both directions. The default is FOWARD_ONLY if you don't specify anuthing. Check the API for how to use the constants. ------------------ Bosun SCJP for the Java� 2 Platform
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Rajesh Kumar
Greenhorn
Joined: Nov 16, 2001
Posts: 28
posted
0
hai in ur program u r using jdk 1.3 method so instead of using like this.. Statement stmt = con.createStatement(); use like this... Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY); then try and give me the reply Thankyou VeryMuch Yours Rajesh