Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drop database problem

Status
Not open for further replies.

gny

Programmer
Jun 3, 2001
116
SE
I have a class module in Access, whose objects hold a connection to an SQL7 database. I have one database per object plus a database for administering the other ones.
When I want to delete an object permanently, I close that object´s connection to its db, set the object to nothing and then use the "administrative" db to drop the database for the object that I want to delete. This doesn´t work. I get an error message saying that the database cannot be dropped because it is currently in use, even though i have closed the connection. I have even tried waiting for a few seconds after the connection was closed before I tried to drop the database, but it still didn´t work. Why does SQL7 consider the database still in use and what can I do to tell it not to?

/gny
 
Never mind, I figured it out myself. I just queried the sysprocesses table for processes using the db and KILLed the spid I got from there.
 
You need to check that Access may be opened by somebody. If so close it then drop your db.
 
Just because you close the connection at the client doesn't mean that the server closes the connection. There is a timeout for each client connected to the database. Worst case, you can stop/start sql server service and you will be able to drop the database. I don't remember the timeout value, but I'm fairly sure it's less than 15 minutes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top