Link to home
Start Free TrialLog in
Avatar of MoMarvi
MoMarvi

asked on

Unlock MS Asscess Databases

My site uses an Access database thorugh a DSN Connection. Every once in a while, I get a page that doesn't completly work, and the code to close the database sticks the databse open, and I get an ldb file.

Since every page in my site uses the database, If I don't close the database, I eventually lock the site up.

I've tried deleting or renaming the ldb fle from ftp, but I can't. Is there a script (I use vbscript) of some sort that can unlock the database?

Thanks

M
ASKER CERTIFIED SOLUTION
Avatar of masirof
masirof

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
While using an Access database for web stuff is not unheard of, it is definitely not the best practice. I would recommend migrating to an MSDE or SQL Server 2000 platform if possible. If not, then you might want to try:
1. using a DSNless connection vs. DSN.
2. take a look at how your recordsets are using the tables, recordlocking, etc..
3. might be a network issue if the database resides on a network share.
4. the database might become extremely bloated, try running a nightly batch script to compact and repair the database.

note: Access always creates a lockfile when the database is opened.
I agree with both, but masirof has a point

If you dont close the database connection in every page then every time you navigate to another one you are opening another database connection, MSaccess can only handle about 25-30 connections at once, and that is on a very very Good day!!!
It looks like all possibilities have been covered but showing the code eliminates the guesswork.
Avatar of MoMarvi
MoMarvi

ASKER

Sorry this has taken so long

masirof
Sometimes, stopping the website doesn't release the lbd file.

Jokra_the_Barbarian
I would love to use something more robust than Access, but there are several reasons to use it for now.
Why would a DSNLess connect work better? I thoguht a DSN was more efficient.
I know my problem has to be with not closing all my connections. My code was pretty sloppy when I started. I am tracking down the leaks, but it takes a while with several hundred pages.
It's not a network issue, since the db is on the same folder as the rest of the site
The database may be becoming bloated. I'll have to look into compacting on the server.

apresto
I think as I said to Jokra_the Barbarian that I have a leak or ten by not closing connections.

kiddanger
Since I'm not sure of where the rest of my leaks are, posting the code is highly improbable, unless you have a Bambleweenie 2000 Matrix Generator, and a really hot cup of tea (Sorry, I'm waiting for the Hitchhikers Guide to the Galaxy Movie to come out)

MoMarvi...

Not showing relevant code is not going to get you much help.
A DSN-less connection is more efficient because it doesn't have to pass the connection off, it just connects directly.  Doing one thing is more efficient than than doing two things.
If you have leaks, then close connection and destorys objects.

If you have an open connection, and it's called conn, then:

conn.Close

Same for recordsets:

rs.Close

Then destroy the objects:

set conn = nothing
set rs = nothing

In VBScript, an obect is defined by 'set'.  So, if you created an object, destroy it.  Simple.  Just match the sets.
Avatar of MoMarvi

ASKER

Kid

I know about the leaks, and I am hunting them down. I know how to close and destry connections, I just got a bit sloppy in my initial coding.

As I said before, I have 150 separate pages that call the database, so picking the code to show is a bit daunting. My question had to do with how to unlock a locked database, until I track down the leaky code.

Any Ideas?

Mo
You shouldn't have a locked database.  You should also consider using includes and put common routines in one file, rather than putting the same routine in multiple files.  Also, if you're using ODBC, I'd recommend against it.

See if this will help for now:
http://www.enterhost.com/supportcenter/faq/search_answer.cfm?fqid=100113
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.  I will make a recommendation to the moderators on its resolution in a week or two.  I appreciate any comments that would help me to make a recommendation.

Unless it is clear to me that the question has been answered I will recommend delete without refund of points.  It is possible that a Grade less than A will be given if no expert makes a case for an A grade.  It is assumed that any participant not responding to this request is no longer interested in its final disposition.

If the user does not know how to close the question, the options are here:
https://www.experts-exchange.com/help.jsp#hs5

WMIF
EE Cleanup Volunteer
Never got a reply.
Avatar of MoMarvi

ASKER

It's taken a while, but I've tracked down all my leaks, and resolved the issue.

masiroff was correct. It just took along time to track down all the open connections.

My original question was how to unlock a locked acces database. Even stopping IIS will not unlock a locked access database. A full reboot (Not fun to ask for on a shared server) seems to be the only way to unlock the database.

IIS has nothing to do with Access.  Access is not an application server like MS SQL.  A full reboot is not required.  You have another option.

http://www.hostmysite.com/support/programming/locked-db/
Avatar of MoMarvi

ASKER

Interesting,

HostMySite is my host, and they never suggested this during our discussions.

Oh-well.
They may not know it is an option.  I would think they gave you a truthful answer based on their knowledge in this area.
Avatar of MoMarvi

ASKER

I have dealt with several hosts in the past couple of years, and HMS has been by far the best. HSB has been orders of magnitude better than any host I have used, including one that was a branded site of a huge US PC manufacturer.

I'll let this one by.
I'm not familiar with them but I'm sure there are plenty of good hosts out there.  I have been happy with discountasp.net, actwd.net and exabytes.com.