This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes rumtime error for JDBC access using features of JDBC 2.0 and oracle thin driver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "rumtime error for JDBC access using features of JDBC 2.0 and oracle thin driver" Watch "rumtime error for JDBC access using features of JDBC 2.0 and oracle thin driver" New topic
Author

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

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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

Joined: Feb 06, 2001
Posts: 358
well i am not sure but try to add code to turn off autocommit.
con.setAutoCommit( false );


Cheers,<br />Rani<br />SCJP, SCWCD, SCBCD
 
 
subject: rumtime error for JDBC access using features of JDBC 2.0 and oracle thin driver
 
Similar Threads
What's wrong with this code?
Establishing Connections to a Data base on a different machine
Adding a record to a database-new to JDBC
Error ,Who can tell me ??
using more than one sql statements in a preparedstatement