Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Record level locking

 
Garry Kalra
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can i incorporate record level locking into my database. What other kind of locks are available
 
MIchael Kmiec
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Joel Cochran
Ranch Hand
Posts: 301
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Daniel Dunleavy
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Garry,
You might try PostgresQL
Dan
 
Andrew Shafer
Ranch Hand
Posts: 338
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

PostgreSQL will support transactions.
They also provide a conversion utility for converting MySQL to PostgreSQL.
http://www.pgsql.com/
 
Anil Vupputuri
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic