• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem related to locking the table

 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
ranchers,

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

thanks®ards,
nagaraju.
 
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try setting the transaction level using the connection object.

Example :

con.setTransactionIsolation(8);

The int values represents 0= TRANSACTION_NONE
1= TRANSACTION_READ_UNCOMMITTED
2=TRANSACTION_READ_COMMITTED
4=TRANSACTION_REPEATABLE_READ
8=TRANSACTION_SERIALIZABLE

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

 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you commit the lock statement?

 
A lot of people cry when they cut onions. The trick is not to form an emotional bond. This tiny ad told me:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic