Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread Detect disconnected database on USB
Mon, Jan 29 2007 2:22 PMPermanent Link

Marc
Hi,

For users who run my application/data on a USB stick, is there an easy way in DBISAM to detect when the application has lost contact with the
database files due to the USB stick being removed? Or any suggestions? I want a clean way to handle the errors generated by such an occurence. I
use local tables (not client servier). DBISAM version 4. Thanks.
Mon, Jan 29 2007 6:26 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Marc,

<< For users who run my application/data on a USB stick, is there an easy
way in DBISAM to detect when the application has lost contact with the
database files due to the USB stick being removed? Or any suggestions? I
want a clean way to handle the errors generated by such an occurence. I use
local tables (not client servier). DBISAM version 4. Thanks. >>

The only way to do so would be to hook into one of the shell notification
functions in Windows.  However, I'm not sure if there is a specific
notification for removable drive removal.

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Jan 30 2007 3:34 AMPermanent Link

Chris Erdal
Marc <marc@hotmail.com> wrote in
news:60A673CF-C0A2-4AAC-B27A-51E6E4C7EE19@news.elevatesoft.com:

> Or any suggestions?

What about having a function that (re)creates a file in the data directory
and returns true if it succeeds, and false if it gets an error.

Call this function before every data operation, perhaps with a timer to
space out the calls by at least 5 seconds or so.

This may or may not be suitable depending on your application...

--
Chris
(XP-Pro + Delphi 7 Architect + DBISAM 4.24 Build 1)
Tue, Jan 30 2007 4:51 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Marc


I think I've seen something about this on the delphi newsgroups, not sure but its worth a search. I'd also suggest looking on Torry.

Roy Lambert
Sat, Feb 17 2007 5:25 PMPermanent Link

Marc
Thanks Roy,

My application can now detect the removal and addition of USB memory sticks.

How can my application cleanly handle the sudden disappearance/reappearance of the data files? On removal of the USB I can do a
DBISAMDATABASE1.connected:=false, and set the tables.Active:=false, which generates no errors and seems fine. However on reconnection of the
USB and trying to reactivate the database and tables I get a:

DBISAM Engine Error # 9217 - Error reading from the table or backup file 'E:\dbisam.lck'

Thanks for any suggestions...
Sun, Feb 18 2007 7:06 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Marc


The ONLY way you will handle disconnects and reconnects cleanly is to move to c/s.

Roy Lambert
Mon, Feb 19 2007 6:55 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Marc,

<< My application can now detect the removal and addition of USB memory
sticks.

How can my application cleanly handle the sudden disappearance/reappearance
of the data files? On removal of the USB I can do a
DBISAMDATABASE1.connected:=false, and set the tables.Active:=false, which
generates no errors and seems fine. However on reconnection of the USB and
trying to reactivate the database and tables I get a:

DBISAM Engine Error # 9217 - Error reading from the table or backup file
'E:\dbisam.lck' >>

Make sure that you close the entire session being used with the
TDBISAMSession.Close method.  That will ensure that all referenced databases
are closed and no longer trying to access any data on the USB drive.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image