db connection

  • Thread starter Thread starter Aaron
  • Start date Start date
A

Aaron

I wrote a program in c# and oledb for my access database. After each run i
see there's a locked db file in my database folder, it means that my
connection is not closed properly. I did check my code everything seemed
fine. Is there a script or a program that can help me check this? I think I
might have missed something.

Thanks

Aaron
 
My guess, since you didn't show us any code, is that what you are seeing is
connection pooling, add "OLE DB Services=-4" to the connection string to
disable it and see if its that...'tis better to leave it on though when in
production.

Karl
 
I am not sure that just because there is *.ldb file still in your folder
doesn't mean Access didn't close properly.

BTW, is this a webapp or winform?

Greg
 
It's a webapp. The reason I know this is because when I tried to access the
same db from another server(B) it tells me that the db is locked but it's
already closed on the other server(A).
 
Since it is a webapp then there could be something else going on. Make sure
the ASPNET user has read/write rights to the FOLDER that the Access *.mdb
file is sitting in. It needs read/write rights to the folder in order to
properly create (and update) the *.ldb file.

Greg
 
All the permission is correct. I still think there's a db connection left
open in my code somewhere. What is the best way to locate it?
 
I used to have this problem all the time when I was using Access and Cold
Fusion. I don't know if the same solution will work for you but it's worth a
try.

What we used to do to unlock it is send a bad query like Select * from
non-existent table.

Of course, if the database is on a live server and being used then the
unlocked state would not last long. Since Access is file-based, it locks it
while it's in use. It's just the way it works.

Let us know if it works,

Frank
 
Aaron,

Mostly when I have seen your question was the problem that was used a
static(C#)/shared(VBNet) class for the connection, is that what you are
doing as well?

Cor.
 
Back
Top