H
Heinz Kiosk
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
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