Re: Closing Jet Database seems unreliable



Could it be that JET has not finished writing the cache to the database?
Depending on how hard it has been pushed, there might be quite a bit of
uncommitted data there.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

"Heinz Kiosk" <nospampleasetom.mcclelland@xxxxxxxxxxxx> wrote in message
news:qHRGh.7342$Yv5.6015@xxxxxxxxxxxxxxxxxxxxxxx
I am having difficulty getting Jet databases to close by calling the
DbConnection.Dispose method. The method seems to work, and the connection
state changes to closed, but about 25% of the time at some level the
process is keeping hold of the connection, and not deleting the ldb file
for example. Then when I terminate my process the ldb file gets deleted...
Or sometimes if I open and close a whole series of mdb's in sequence the
ldb's will build up and up then suddenly they'll all get deleted at once...
:-\

If I open my databases exclusively (mode-share exclusive) (for safety as
the app is single user) then if I close one and then reopen it in the same
process I'll often get a message that the database is already exclusively
open.

Suspecting that connection pooling was getting in the way I tried adding
"OLE DB Services= -1" or -4 to the connection string and curiously this
seems to make things worse. It virtually guarantees that the file will
remain open whereas with pooling turned on the closure seems to work about
75% of the time. In tests I can see no difference from my point of view
between the times when the call works and the times when the call fails.

Does anyone know a guaranteed way in ADO.NET of killing a connection to
Jet?

I want to do this so that my app can (for example) backup or restore the
Jet database from a menu prompt while the app is still running.

Is there any way of spying what is happening at the underlying Jet level?

Thank you for your help,

Tom


.



Relevant Pages

  • Re: ADO Connection Timeout
    ... so what happens when a connection failure forces one station to revert ... to a local database? ... Further, you *will* have contention issues, Jet does not support record ... to the central server, but you are willing to live with periods where it ...
    (microsoft.public.data.ado)
  • Re: Please Urgent - Update Data Source Problem ???
    ... When the app starts, I'd check to see if the table exists. ... That'd probably be a preferable method to creating the database each time ... If you put connection close ... schedule, and they can update the existing schedule, add new schedule and ...
    (microsoft.public.dotnet.framework.compactframework)
  • ASP.NET data access
    ... We have used ADO datasets previously for a windows application that we developed where the entire db was loaded into the dataset at the beginning of the application and the user made changes to the dataset which was then saved back to the db when the app was shut down. ... Which means that when data is required it is returned from the dataset saving a connection, but has used a heap of resources loading from the db in the first place. ... We would in this case have insert methods which would then use inserts, updates and deletes to directly update the database. ... The problem that this technique seems to have is that you are creating a dataset in each method, which is failur repetitive and may only contain a few rows. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: OleDbConnection does not release Access database
    ... this is not a web app. ... a Microsoft Access database. ... the database connection, but that seems a little excessive for what ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Explorer CPU Usage while accessing database
    ... Since Jet is a file-based database, the answer is: ... I suspect you are seeing the Jet delayed-write system in action. ... creates an idle period, during which Jet (and any other processes that are ... opening your connection before each insert and closing it immediately after ...
    (microsoft.public.scripting.vbscript)