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 WHY I can't see transaction for jdbc api 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 "WHY I can Watch "WHY I can New topic

WHY I can't see transaction for jdbc api

liang sun
Ranch Hand

Joined: May 12, 2001
Posts: 51
in ejb's method, i have a program using JDBC API.
ejb'method's transaction attribute is required as default.
It is container managing transaction bean.
Statement s=con.createStatement()
s.execUpdate("sql1 "); //sql1 is correct "insert into.."
s.execUpdate("sql2"); //sql2 is false "insert into."
catch(Exception e)
throw new EJBException();
when executing, client program received ejbException from ejb.
but "sql1"'s executing result reflect to Database though "sql2"
execute failure��
why contain's transaction don't work?(in session bean and entity bean'S attempting result is same)
pls give me some advice or material

Stanley Tan
Ranch Hand

Joined: May 17, 2001
Posts: 243
I am not sure what exactly you are asking. But from what I can gather, you have to set auto commit to false. That way you can execute several SQL statements and latter if something goes wrong rollback the statements as if nothing had happened.
I agree. Here's the link:
subject: WHY I can't see transaction for jdbc api
Similar Threads
Stateless EJB and transactions..pls help
JDBC with database specific calls
why i can't see transaction for ejb.
SQL Exception!!
how to parse java.util.Date to ?