This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: rumtime error for JDBC access using features of JDBC 2.0 and oracle thin driver