SunQuest
           Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old August 4th, 2003, 06:48 AM
shafan's Avatar
shafan shafan is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 123 shafan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 51 m 51 sec
Reputation Power: 6
open Access database for exclusive use

Hi,
I have an Access database used by 2 users who connect to it from a VB app using ADO.
I want to prevent them working on it at the same time - display a message saying 'the database is busy try later'.
I open the ADO connection in Mode=Share Exclusive.
Even though there is an ldb lock file both users access the database at the same time!
Any ideas?

Thanx

Last edited by shafan : August 14th, 2003 at 07:14 AM.

Reply With Quote
  #2  
Old August 7th, 2003, 11:39 PM
alanbmiller alanbmiller is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: San Jose, CA
Posts: 6 alanbmiller User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
You might try a batch file

Kind of hokey, but I use this technique often in Windows. Write a batch file that detects whether the .ldb file exists. If it does, tell the user to try again later.

Untested code that I'll just type:

echo off
rem This batch file detects whether a file
rem exists. If it does, it exits. If it
rem doesn't it executes access.
if exist (filename).ldb goto fail
msaccess.exe (filename).mdb parameters
goto end
fail:
cls
echo Access currently in use. Try again later!
end:


I often use a batch file to detect newer versions of the front-end so that I don't have to wander around installing it every time I fix a bug.

Good luck!

Reply With Quote
  #3  
Old August 10th, 2003, 01:52 AM
shafan's Avatar
shafan shafan is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 123 shafan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 51 m 51 sec
Reputation Power: 6
that's exactly how I've solved it (not with a batch but with the Dir function).

The problem is that if Access crashes the ldb file isn't removed and therefore the application 'thinks' a user is loged on.

Last edited by shafan : August 10th, 2003 at 06:52 AM.

Reply With Quote
  #4  
Old August 13th, 2003, 09:50 AM
mitakeet's Avatar
mitakeet mitakeet is offline
Last Day: May 28, 2005
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Jul 2003
Location: Maryland
Posts: 4,575 mitakeet User rank is Sergeant (500 - 2000 Reputation Level)mitakeet User rank is Sergeant (500 - 2000 Reputation Level)mitakeet User rank is Sergeant (500 - 2000 Reputation Level)mitakeet User rank is Sergeant (500 - 2000 Reputation Level)mitakeet User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 8 h 5 m 34 sec
Reputation Power: 20
Your only real solution

is to upgrade to a real database.
__________________

Left DevShed May 28, 2005. Reason: Unresponsive administrators.
Free code: http://sol-biotech.com/code/.
Secure Programming: http://sol-biotech.com/code/SecProgFAQ.html.
Performance Programming: http://sol-biotech.com/code/PerformanceProgramming.html.

It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
--Me, I just made it up

The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
--George Bernard Shaw

Reply With Quote
  #5  
Old August 13th, 2003, 10:48 AM
a.koepke's Avatar
a.koepke a.koepke is offline
Second highest poster :p
Dev Shed God 5th Plane (7000 - 7499 posts)
 
Join Date: Jul 2001
Posts: 7,323 a.koepke User rank is Sergeant (500 - 2000 Reputation Level)a.koepke User rank is Sergeant (500 - 2000 Reputation Level)a.koepke User rank is Sergeant (500 - 2000 Reputation Level)a.koepke User rank is Sergeant (500 - 2000 Reputation Level)a.koepke User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 8 h 8 m 45 sec
Reputation Power: 27
In the commandline you can append the database file name (xxx.mdb) with "/excl" to make it open exclusively.

Reply With Quote
  #6  
Old August 14th, 2003, 07:16 AM
shafan's Avatar
shafan shafan is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 123 shafan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 51 m 51 sec
Reputation Power: 6
Thanx, but I connect to the database using ODBC from a VB app and don't use a command line

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > locking Access database for exclusive use


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway