aspose file tools*
The moose likes JDBC and the fly likes When is exclusive lock released Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "When is exclusive lock released" Watch "When is exclusive lock released" New topic
Author

When is exclusive lock released

gokul maha
Greenhorn

Joined: Jun 27, 2006
Posts: 25
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

Joined: Jun 27, 2006
Posts: 25
I dont have any commit statement in Stored procedure also.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

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).


JBoss In Action
gokul maha
Greenhorn

Joined: Jun 27, 2006
Posts: 25
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

Joined: May 14, 2008
Posts: 5836
    
    7

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

Joined: Jun 27, 2006
Posts: 25
Thanks for the info Peter.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: When is exclusive lock released