mdb read only - not the usual problems

  • Thread starter Thread starter cjb
  • Start date Start date
C

cjb

Hi,

I originally posted this on public.data.ado, and someone nicely
informed me that this group is probably better suited to my question,
so here goes:

I have an mdb that I open using asp.net. I edit these pages and code
using FrontPage.

Everything works fine, but sometimes I make a mistake in my code, and
my page errors out before I close the DB connection. When this happens,
sometimes, the mdb becomes read only, as in when I open the mdb by
double clicking, I get "The database <name> is read-only" pop up.

If I try to edit via Front Page, I can, but FP cannot update the mdb,
because it is read only. (I understand all that).

Usually, this resolves itself auto-magically in a couple of hours. My
question is, how can I resolve it myself?

Also, I can go to a page with no errors, and run the page no problem,
code opens a db con, gets data, and closes it. I did this in the hope
that the IIS user close any locks they had on the db if I did a
succesfull con.close. This does not work.

Thanks for any help or advice.

I posted this in ado.net forum because I think it is my code causing
the
problem, I just can't fix it.

I'm interested in fixing this problem once it occures, because I don't
understand what is happening. Here is db that is read-only, and I can't
see any reason for it to be, nor can I revert it. Thanks again
 
On 20 Dec 2005 06:46:30 -0800, (e-mail address removed) wrote:

¤ Hi,
¤
¤ I originally posted this on public.data.ado, and someone nicely
¤ informed me that this group is probably better suited to my question,
¤ so here goes:
¤
¤ I have an mdb that I open using asp.net. I edit these pages and code
¤ using FrontPage.
¤
¤ Everything works fine, but sometimes I make a mistake in my code, and
¤ my page errors out before I close the DB connection. When this happens,
¤ sometimes, the mdb becomes read only, as in when I open the mdb by
¤ double clicking, I get "The database <name> is read-only" pop up.
¤
¤ If I try to edit via Front Page, I can, but FP cannot update the mdb,
¤ because it is read only. (I understand all that).
¤
¤ Usually, this resolves itself auto-magically in a couple of hours. My
¤ question is, how can I resolve it myself?
¤
¤ Also, I can go to a page with no errors, and run the page no problem,
¤ code opens a db con, gets data, and closes it. I did this in the hope
¤ that the IIS user close any locks they had on the db if I did a
¤ succesfull con.close. This does not work.
¤
¤ Thanks for any help or advice.
¤
¤ I posted this in ado.net forum because I think it is my code causing
¤ the
¤ problem, I just can't fix it.
¤
¤ I'm interested in fixing this problem once it occures, because I don't
¤ understand what is happening. Here is db that is read-only, and I can't
¤ see any reason for it to be, nor can I revert it. Thanks again

Try deleting the associated .LDB file is there is one. Otherwise, you will probably need to close
the application that has the database open (which is probably your development environment).


Paul
~~~~
Microsoft MVP (Visual Basic)
 
Whenever you open a Connection, use a Finally block to ensure that the
Connection gets closed even if an error occurs ...

Try
cn = Common.GetConnection()
'etc
Finally
If Not cn Is Nothing Then
If cn.State <> ConnectionState.Closed Then
cn.Close()
End If
End If
End Try
 
Thanks for your answers and ideas guys.

When the db locks up, there is no .ldb, and I close my dev environment
(FrontPage) and all browsers that might have an opening on the file.
Still the db is read only.

Brendan, thanks for the suggestion. That can prevent the problem in the
future, but I'm still curios why this file is locked, and how to unlock
it.

Thanks again guys,

CJB
 
I encountered what I believe to be the same problem you describe while
working with JET and the OLEDB provider. However, that was several months
ago, and since then all my work has been with the SQL Server provider, which
has largely driven the details of the JET/OLEDB experience from my memory. I
know that, at the time, I was convinced that the problem was an unclosed
connection, but I can't remember now exactly what it was that convinced me
of that.

If all else fails, re-booting should unlock the MDB.
 
On 21 Dec 2005 06:45:11 -0800, (e-mail address removed) wrote:

¤ Thanks for your answers and ideas guys.
¤
¤ When the db locks up, there is no .ldb, and I close my dev environment
¤ (FrontPage) and all browsers that might have an opening on the file.
¤ Still the db is read only.
¤
¤ Brendan, thanks for the suggestion. That can prevent the problem in the
¤ future, but I'm still curios why this file is locked, and how to unlock
¤ it.

If there is no .LDB file and the file is open, that would indicate to me that there is an exclusive
lock on the database. Typically it's the development environment.

If you want to find out for certain you may want to download a free utility called Process Explorer.
It's a great tool for handling issues such as these.

http://www.sysinternals.com/Utilities/ProcessExplorer.html


Paul
~~~~
Microsoft MVP (Visual Basic)
 
Thanks for you help guys.

This is an intermitant problem that has been going on for a while.
Usually when it happens I copy the DB, rename it, and rename my
connection string. This is a pain, an oppens the possibility that I
confuse the two DB, and end up pushing out a stale DB. That and I want
to know whats going on.

I'll try the Process explorer. I tried a different utility from them, I
think WhoLockME, but didn't find much out.

Thanks again,

CJB
 
Back
Top