aspose file tools*
The moose likes JDBC and the fly likes Record level locking 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 "Record level locking" Watch "Record level locking" New topic
Author

Record level locking

Garry Kalra
Ranch Hand

Joined: May 25, 2001
Posts: 111
How can i incorporate record level locking into my database. What other kind of locks are available
MIchael Kmiec
Greenhorn

Joined: Jun 05, 2001
Posts: 9
Implementing this really depends on what database you are using. (I'm not a DBA, so take everything I say with a large grain of salt.)
Also, is there a particular reason you want to do this? In my (limited) experience, record-level locking makes things run a bit slower. It can be a blessing, especially if your application is multi-threaded and data is getting whacked all over the place - provided you use it on a table-by-table basis.
Best,
/mike
Bjarki Holm
Author
Ranch Hand

Joined: May 25, 2001
Posts: 65
I agree to Michael. Locking is highly database dependent, and should generally not be manually done by the application.
B.t.w., what type of database are you using?

------------------
Bjarki Holm
Author of Professional Java Data


Bjarki Holm
Joel Cochran
Ranch Hand

Joined: Mar 23, 2001
Posts: 301
Bjarki,
Since it seems to apply to record level locking, could you give a brief explanation of the different uses of COMMIT with JDBC SQL? I'm just learning both and in DB2/400 record level locking is pretty much the norm.
Thanks,
Joel
------------------
I'm a soldier in the NetScape Wars...
Joel


Wait a minute, I'm trying to think of something clever to say...<p>Joel
Daniel Dunleavy
Ranch Hand

Joined: Mar 13, 2001
Posts: 276
Most databases have different levels of locking that amount to
record locking: locking to the smallest storage area that contains the record
page locking: where storage is allocated to pages of data, and the page is locked. So any records in the same page are locked also
Table locking. Locking all records in the same table.
Depending upon what you are doing you might end up do a table lock because of the number of records selected in the where clause.
Usually you want to get down to the lowest level, so other users are not impeded by your process. But at other times you may need to lock the entire table.
Dan
Garry Kalra
Ranch Hand

Joined: May 25, 2001
Posts: 111
Thank you all for replying.
The database i am using is MySQL and i don't think that it supports transactions because using setAutoCommit(false) fails.
I need transactions support for my website and also want to use jsp.
please guide me as r there any other hosts offering jsp and database support besides webappcabaret.
Also if transaction support is available in mysql, then how do i use it.
Thank you all
Garry
Daniel Dunleavy
Ranch Hand

Joined: Mar 13, 2001
Posts: 276
Garry,
You might try PostgresQL
Dan
Andrew Shafer
Ranch Hand

Joined: Jan 19, 2001
Posts: 338

PostgreSQL will support transactions.
They also provide a conversion utility for converting MySQL to PostgreSQL.
http://www.pgsql.com/


!_I_Know_Kung_Fu_!
Anil Vupputuri
Ranch Hand

Joined: Oct 31, 2000
Posts: 527
If u want it for free of cost, then better go with www.mycgiserver.com its the best I have seen.
They have Hypersonic SQL and supports JSP1.1, Servlet 2.2 and JDBC1.X should support but Im not sure of
JDBC2.0

[This message has been edited by Anil Vupputuri (edited June 14, 2001).]


SCJP 1.5, SCEA, ICED (287,484,486)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Record level locking