wood burning stoves 2.0*
The moose likes JDBC and the fly likes problem related to locking the table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "problem related to locking the table" Watch "problem related to locking the table" New topic

problem related to locking the table

NagarajGoud uppala
Ranch Hand

Joined: Nov 13, 2008
Posts: 86

i am facing a problem while applying locks on the oracle table.my intention is stop the accessing of table to other users, if the table is locked by one user.

for this i wrote the code as follows

after locking i inserted some data into table, after insertion i am not commiting it because if i commit,the lock will be release.next i am trying to insert data into that table from another system,actually the data don't insert.but data is inserted. how it is happening like that ??

in another scenario, if execute the locking query on the database directly then trying to insert into database through java application, at that time it is not giving permission to access table(in this case evrything is fine).

please guide me


I know Life is very Tough...But I AM TOUGHER
SCJP 1.5
Nilesh Raje
Ranch Hand

Joined: Aug 02, 2005
Posts: 153
Try setting the transaction level using the connection object.

Example :


The int values represents 0= TRANSACTION_NONE

8 should be a good option for you else you can use the values as per your need.

Thanks and Regards,<br />Nilesh<br />SCJP 1.4, SCWCD 1.4
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Do you commit the lock statement?

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: problem related to locking the table
Similar Threads
how to convert .csv files into sql server files using java
problem related to locking the table
Values inserted but not showing up in MS Access table
JDBC Error--> [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1
JDBC Connection