• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error while setting save point in connection object

 
kamalakannan kamal
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am getting following error when i tried to set save point in a connection object.

"Exception in thread "main" java.lang.AbstractMethodError: oracle.jdbc.driver.OracleConnection.setSavepoint()Ljava/sql/Savepoint;"

Can any of you explain why this error is coming and any solution for this?

Full Program is as follow

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Savepoint;
import java.sql.Statement;

public class SavePoint {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection connection = DriverManager.getConnection("jdbcracle:thin:@localhost:1521rcl","oracle","Oracle");
connection.setAutoCommit(false);
String update1 = "update stock set qty = 100 where item_number = 1000";
String update2 = "update stock set cost=100 where item_number = 1000";
String update3 = "update stock set description='Check' where item_number=1000";
Statement statement = connection.createStatement();
statement.executeQuery(update1);
Savepoint savepoint = connection.setSavepoint();
statement.executeUpdate(update2);
statement.executeUpdate(update3);
connection.rollback(savepoint);
connection.commit();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
 
Jan Cumps
Bartender
Posts: 2608
14
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any of you explain why this error is coming and any solution for this?
The JDBC driver that you use does not support it.
See this other post:
Savepoint support was supposedly added in the 9.2.0.1 version of the Oracle driver, according to the README.


Regards, jan
 
kamalakannan kamal
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jan Cumps. I used different driver and this program got executed.

Regards,
Kamal
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic