File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes concurrent connections using ODBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "concurrent connections using ODBC" Watch "concurrent connections using ODBC" New topic

concurrent connections using ODBC

Jai Parmar

Joined: Dec 02, 2005
Posts: 8
I am trying to connect to a MS access database using a JSP.
I will be having between 10-20 people acccessing this database.
I was wondering if it explicitly stated each request is a transaction or does that need to be programmatically added?
The datbase connection is made using a servlet, and if so does the class need to use the syncronise to make sure its only has one user accessing the database at any one time?
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3749

First off, if you can use a real database instead of Access, please do. It's just not a good choice in most professional situations.

That said, I'm going to say no, you have no transactional support if you are accessing JDBC via a servlet. That means you could have half-completed transactions and many other anomolies. If you are accessing a database directly from a servlet (which is a bad practice), you need to create a UserTransaction so that if anything fails, you can roll back the entire transaction.

There's absolutely no synchronization control on the database nor should there be, the performance hit is too big. I suggest an optimistic locking solution which is basically read data, process it, and write to a table but before writing check to make sure no one else has modified this data, often using a time stamp or counter.

Using J2EE via an EJB session bean, you get a ton of transaction management for free, but it requires using a J2EE server as well as adding a lot of setup work.
[ December 08, 2005: Message edited by: Scott Selikoff ]

[OCA 8 Book] [Blog]
I agree. Here's the link:
subject: concurrent connections using ODBC
It's not a secret anymore!