I am using ADO to execute a DROP DATABASE command. Before that I run some
query against the DB to do some checks. However I get the meesage "Cannot
drop the database XXX because it is currently in use". If I do not run the
query before the DROP works. I have made sure that all connections to the DB
are closed.
I run the SQL Profiler and noticed that there is an "Audit Login" line added
before a command and a corresponding "Audit Logout" afterwards. Now I
noticed that the "Audit Logout" command takes some time to appear in the
trace window. I put a message box before my DROP command and after my query
and waited till the "Audit Logout" appeared. Then the DROP worked. So it
seems that there is some kind of delay before the DB is "released" after my
query is run.
Is there some expalnation/solution to that?
Thanks
YannisYannis wrote on Wed, 17 May 2006 10:30:01 +0300:
> I am using ADO to execute a DROP DATABASE command. Before that I run some
> query against the DB to do some checks. However I get the meesage "Cannot
> drop the database XXX because it is currently in use". If I do not run the
> query before the DROP works. I have made sure that all connections to the
> DB are closed.
> I run the SQL Profiler and noticed that there is an "Audit Login" line
> added before a command and a corresponding "Audit Logout" afterwards. Now
> I noticed that the "Audit Logout" command takes some time to appear in the
> trace window. I put a message box before my DROP command and after my
> query and waited till the "Audit Logout" appeared. Then the DROP worked.
> So it seems that there is some kind of delay before the DB is "released"
> after my query is run.
> Is there some expalnation/solution to that?
> Thanks
> Yannis
Do you have connection pooling enabled? Connections which are "closed" by
the application will be passed to the pool so they can be reused by another
request, rather than starting a new connection from scratch. The delay will
be due to the connection pool holding the connection open and then releasing
it after the set timeout.
Dan|||Thank you Daniel,
I don't do anything relating to connection pooling.
Any idea where that may occur in ADO and what I can do to overcome it?
Yannis
"Daniel Crichton" <msnews@.worldofspack.com> wrote in message
news:%23GWlEFZeGHA.380@.TK2MSFTNGP04.phx.gbl...
> Yannis wrote on Wed, 17 May 2006 10:30:01 +0300:
>
> Do you have connection pooling enabled? Connections which are "closed" by
> the application will be passed to the pool so they can be reused by
> another request, rather than starting a new connection from scratch. The
> delay will be due to the connection pool holding the connection open and
> then releasing it after the set timeout.
> Dan
>|||You must prevent other connections to access the database:
alter database <db name>
set single_user
with rollback immediate;
use master;
drop database <db name>;
ML
http://milambda.blogspot.com/|||If you're using ODBC drivers, you'll need to make a change to your ODBC
settings in Windows. If you're not, you'll have to dig around for how to
change this for OLE DB or whatever connection type you're using.
Dan
Yannis wrote on Wed, 17 May 2006 15:34:14 +0300:
> Thank you Daniel,
> I don't do anything relating to connection pooling.
> Any idea where that may occur in ADO and what I can do to overcome it?
> Yannis
> "Daniel Crichton" <msnews@.worldofspack.com> wrote in message news:%23GWlEF
ZeGHA.380@.TK2MSFTNGP04.phx.gbl...
Showing posts with label somequery. Show all posts
Showing posts with label somequery. Show all posts
Monday, March 19, 2012
Subscribe to:
Posts (Atom)