• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

rumtime error for JDBC access using features of JDBC 2.0 and oracle thin driver

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following code compiles but on running gives me the following runtime error:
Exception in thread "main" java.lang.AbstractMethodError
at insertrows2.main(insertrows2.java:31)
My code:
import java.sql.*;
import javax.sql.*;
import oracle.sql.*;
import oracle.jdbc.driver.*;

public class insertrows2
{
public static void main(String[] args)
{

Connection con ;
Statement stmt;
try
{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());

con = DriverManager.getConnection ("jdbc racle:thin:@192.168.164.99:1521:nfd1",
"amoli", "amoli");
stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); //Line 31
ResultSet uprs = stmt.executeQuery("select * from emp");
uprs.moveToInsertRow();
uprs.updateInt("no",5);
uprs.updateString("name","Kajol");
uprs.updateInt("salary",29800);
uprs.insertRow();
uprs.updateInt("no",5);
uprs.updateString("name","jack");
uprs.updateInt("salary",10000);
uprs.insertRow();
uprs.beforeFirst();
System.out.println("Employee table after insertion:");
while(uprs.next())
{
int no =uprs.getInt("no");
String name = uprs.getString("name");
int sal = uprs.getInt("salary");
System.out.println(no+" "+name+" "+sal);
}
uprs.close();
stmt.close();
con.close();
}catch(SQLException e){
System.err.println("SQLException:" +e.getMessage());
}
}
}






Thanks in Advance,
Amoli.
 
rani bedi
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well i am not sure but try to add code to turn off autocommit.
con.setAutoCommit( false );
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic