Mombu the Programming Forum sponsored links

Go Back   Mombu the Programming Forum > Programming > Why commit takes place even if I give autoCommit(false)
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 16th April 22:24
pramod
External User
 
Posts: 1
Default Why commit takes place even if I give autoCommit(false)



Hi group,

I am novice to JDBC and here is my doubt

I have set the autoCommit(false) in the piece of code underneath but I
dont know some how the commit takes place. I can see record while is
query the db.
Why this ?

Pramod


Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.
getConnection("jdbcracle:thin:@optiwiseme:1521 w30","pramod","pramod");

con.setAutoCommit(false);
Statement st = con.createStatement();

st.executeUpdate("INSERT INTO IMAGETABLE VALUES(1, EMPTY_BLOB())");
st.close();

con.close();
  Reply With Quote


  sponsored links


2 16th April 22:24
andy flowers
External User
 
Posts: 1
Default Why commit takes place even if I give autoCommit(false)



Where do you see the record ? Within the same application using the same
connection or in a different application ?

If it's the same application with the same connection then this is expected.
Committing a transaction makes it visible to all users, but all changes to
an uncommitted transaction is visible to the connection making it.

There are also other settings related to the transaction isolation. Have a
look at these in the Oracle do***entation, but if another application is
looking at the database in a way to allow data in uncommitted transaction to
be viewed you may see this behaviour.
  Reply With Quote
3 16th April 22:24
thomas kellerer
External User
 
Posts: 1
Default Why commit takes place even if I give autoCommit(false)


Pramod Ramachandran schrieb:

Most probably because closing the connection does an implicit commit on Oracle.
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666