I am using Microsoft JET as the back-end of a web-based application. I am using JavaScript as the interface between the HTML pages and the database. The MDB file is placed on a shared drive accessible to all application users.
Normally the application works fine. One can create, read, update, and delete data just fine. But occasionally, if two persons are using the application concurrently, a very funny thing happens:
User A interacts with the database, making several changes. The changes are all apparent in the application.
User B interacts with the database, making several changes. The changes are all apparent in the application.
However, after both users log out, only User A's changes are retained. Although User B's changes were somehow in the database (the application has no method for pulling data from some other cache), they are nowhere to be found.
I have tried everything I can think of and many other things I have learned from online searches. I create connection objects with local cursors and open locks, and then quickly use and dispose of those connection objects. But despite my best efforts, when two or more are gathered at the database, only one lucky soul gets his data persisted in the database.
My average database transaction now looks like this:
// establish database connection
var objConn = new ActiveXObject("ADODB.Connection");
objConn.open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=db.mdb; Persist Security Info=False");
var objRS = new ActiveXObject("ADODB.Recordset");
objRS.CursorLocation = 3;
objRS.CursorType = 3;
objRS.LockType = 1;
// get data from database
var strSQL = "someSQLstring";
objRS.Open(strSQL,objConn);
[do something with data from recordset]
// cleanup
objRS.Close();
objConn.Close();
Normally the application works fine. One can create, read, update, and delete data just fine. But occasionally, if two persons are using the application concurrently, a very funny thing happens:
User A interacts with the database, making several changes. The changes are all apparent in the application.
User B interacts with the database, making several changes. The changes are all apparent in the application.
However, after both users log out, only User A's changes are retained. Although User B's changes were somehow in the database (the application has no method for pulling data from some other cache), they are nowhere to be found.
I have tried everything I can think of and many other things I have learned from online searches. I create connection objects with local cursors and open locks, and then quickly use and dispose of those connection objects. But despite my best efforts, when two or more are gathered at the database, only one lucky soul gets his data persisted in the database.
My average database transaction now looks like this:
// establish database connection
var objConn = new ActiveXObject("ADODB.Connection");
objConn.open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=db.mdb; Persist Security Info=False");
var objRS = new ActiveXObject("ADODB.Recordset");
objRS.CursorLocation = 3;
objRS.CursorType = 3;
objRS.LockType = 1;
// get data from database
var strSQL = "someSQLstring";
objRS.Open(strSQL,objConn);
[do something with data from recordset]
// cleanup
objRS.Close();
objConn.Close();