• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

simultaneous access to a db from a servlet

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
i am new to jdbc as well as servlets.
i am using MS SQL Server as my db and drivers provided by "JRun " in one of my servlet.my servlet may be accessed by more than one user at the same time.
they may try to write to different records of the same table.
i was told that to avoid conflict between the two statements, we have to set up buffering to either optimistic or pesimistic while getting the resultset.
i have no idea what that means or how to set it up.
any help in this regard will be greatly appreciated.
my system info
JRun3.1/IIS 4.0/NT 4.0/MS SQL Server
Subbu
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to set up a connection pool. A connection pool will allow for multiple simultaneous users to access your db. This will also reduce the overhead because it recycles connections rather than create new connections for every new user. Look at the CoonectionPool class to get started.
 
Subbu Aswathanarayan
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jeff,
I think i didn't word my question correctly.i will explain it once again.
my problem is not connection pooling.as a matter of fact i am using connection pooling.my question is, what if two users try to update two different records of the same table.will the table get locked or just the record.someone mentioned to me that we can control if the entire table gets locked or just the record being updated.
i want to know how can this be done using java.
thanks for ur reply.
Subbu
 
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I remembered corretly, MS SQL Serve does record locking. For multi-access, you don't need to code that in Java. Any good database system should be able to handle it correctly.
 
Are we home yet? Wait, did we forget the tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic