Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

When is exclusive lock released

 
gokul maha
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a J2EE app which connects to DB2.
In one method, I have a Stored procedure call which has INSERT SQL.

I DON'T have any transaction mgmt in my application. In this case, when does the exclusive lock gets released?


Thanks,
Gokul
 
gokul maha
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont have any commit statement in Stored procedure also.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using auto-commit? If so, as soon as the stored procedure is done processing.

In general, changes are made permanent and locks released once a commit is done, whether an autocommit (as soon as the statement/procedure is done) or a manual commit (your code making the commit call, or JPA/Hibernate/other-db-framework making the commit call).
 
gokul maha
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Am not using auto-commit in my code.
By default in DB2, auto-commit is set to TRUE right?
Can this be configured in the application server datasource settings?
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
gokul maha wrote:By default in DB2, auto-commit is set to TRUE right?

I don't know about DB2, but for most databases auto-commit is true be default.

Can this be configured in the application server datasource settings?

Yes. See your app server docs for how to.
 
gokul maha
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the info Peter.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic