File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Please Help, Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Please Help," Watch "Please Help," New topic

Please Help,

Srini Kesavan

Joined: Jan 18, 2003
Posts: 18
When i set this conn.setAutoCommit(false); (conn - Connection) The following exception is being thrown.
[Microsoft][ODBC Microsoft Access Driver]Attribute cannot be set now
Here is my code. I would highly appreciate if anyone can suggest the reason for this.
public void actionPerformed(ActionEvent e) {
if(e.getSource() == update) {
try {
System.out.println (conn.getAutoCommit());
System.out.println (conn.getAutoCommit()); Statement stmt = conn.createStatement(); stmt.executeUpdate("UPDATE EMPLOYEE SET FNAME = 'John' WHERE SSN = '123456789' ");

}// end of try block
catch (SQLException sqex) {
try {
catch(Throwable t) {}
System.out.println("error ");
}// end of catch block
}// end of if block
} // end of action performed method


Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Sounds like the driver you are using does not support transactions.

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Xuening Ma

Joined: Jul 25, 2002
Posts: 6
Hi, guy:
You must have open statement and let it still open when you setAttribute, just close all of the Statement&resultset based on this connection, you will get it.
(I met this problem also, I resolved it)
I agree. Here's the link:
subject: Please Help,
It's not a secret anymore!