Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2007

Tip: Looking for answers? Try searching our database.

Record lock - SQL Server 2005

Thread view: 
hemaraj_dv.2005@yahoo.co.in - 11 Sep 2007 07:27 GMT
Hello

The back end of my Java application is SQL Server 2005, in multi user
environement.

There are few counters stored in a table. Each record that is
created , looks up the relevant counter field, uses it, updates it
(adds one) and writes it back to db.

To ensure that while a counter is read by some user, it can not be
read by another until the first user is done with it, is it enough to
use

conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED );

and this will create the record lock so two user can not access at
same time, or other process is also needed?

For example anything else from java side or any setting from SQL
Server 2005?

Thank you
Hemaraj
Arne Vajhøj - 15 Sep 2007 01:58 GMT
> The back end of my Java application is SQL Server 2005, in multi user
> environement.
[quoted text clipped - 14 lines]
> For example anything else from java side or any setting from SQL
> Server 2005?

You should a SQLServer expert.

My understanding is that either:

you use transaction isolation level serializable

or:

you select WITH (TABLOCKX) in your sql statement.

Arne
derek - 15 Sep 2007 02:43 GMT
are you trying to generate unique ids for each record? is that why you are keeping a counter? if so, why not just use an identity column?


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.