Re: DetachDB problems - DMO

From: siaj (siaj_at_discussions.microsoft.com)
Date: 02/15/05


Date: Mon, 14 Feb 2005 19:15:04 -0800

Use Profiler to know which application is opening a connection to the
Northwind Database.
siaj

"Elmo Watson" wrote:

> Only one connection shows as Northwind - its host is the computer name - -
> However, this can happen when I reboot and start fresh - that's the way it
> comes up - I haven't run any program I know that hits the database.
>
> I added a line :
> oDataBase=oServer("master") - to make sure it hits the master when it
> connects....
> I also changed the default database to master
>
> No matter what - it seems like there is always a connection to the Northwind
> database (or any others also, for that server - - )
>
> I just don't understand how this is happening and how to get around it...
>
>
>
> "siaj" <siaj@discussions.microsoft.com> wrote in message
> news:34D5FCE9-C469-4B7A-AFA7-E9731EECF209@microsoft.com...
> > Hi,
> > 1.How many process show as the DBname as Northwind .... ideally they
> should
> > be none.
> > 2. Which is the default database in ur SQL server. Verify that it should
> be
> > master in ur case. If not u can set it through sp_defaultDB in QA
> > 3. While connecting through SQL-DMO make sure no users are connected to
> the
> > said DB(including urself/ QA)
> > 4.In oServer.Connect (Servername), ServerID, ServerPwd also specify the
> > dbname property as "master"
> > 5. Verify now thru sp_who how many connections are there to Northwind
> > ..ideally there should be none.
> > 6. Now try to dettach the DB
> >
> > Let us know if u have any success...
> >
> > cheers,
> > siaj
> >
> >
> > Which is your default database in the SQL Server.....
> >
> > "Elmo Watson" wrote:
> >
> > > I see 16 entries when I do what you ask - most say background or
> > > sleeping - - one says runnable - - I'm afraid I really don't know what
> this
> > > gives me...
> > > how can I close all connections before doing this?
> > >
> > >
> > >
> > >
> > > "siaj" <siaj@discussions.microsoft.com> wrote in message
> > > news:6185D09E-6052-4CA8-8AE1-60EBE323149B@microsoft.com...
> > > > hi,
> > > > Appears that there is a connection string live with the Northwind
> database
> > > > when you are dettaching the Northwind DB. Verify the same by putting a
> > > > breakpoint just before oServer.DetachDB(DBName, True) and then connect
> to
> > > > master DB from queryanalyzer and fire sp_who.
> > > >
> > > > Ideally while using DMO you should connect explicitly to master db and
> > > then
> > > > try to dettach any other db.
> > > >
> > > > Let us know if it solves ur issue...
> > > >
> > > > cheers,
> > > > siaj
> > > >
> > > >
> > > >
> > > > "Elmo Watson" wrote:
> > > >
> > > > > I have the following code:
> > > > > Set oServer = New SQLDMO.SQLServer
> > > > > oServer.Connect (Servername), ServerID, ServerPwd
> > > > > Call oServer.DetachDB(DBName, True)
> > > > > oServer.Close
> > > > >
> > > > > however, I continue getting the following error:
> > > > > "Cannot detach the database 'Northwind' because it is currently in
> use"
> > > > >
> > > > > Doing a detach with Enterprise manager works just fine on the same
> > > > > server/db - - it's just that, with coding it, I get the error - -
> > > > >
> > > > > what might I be doing wrong?
> > > > >
> > > > >
> > > > >
> > >
> > >
> > >
>
>
>
>



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: ADO Connection Timeout
    ... When the first test is run, the results are stored in the central database. ... to the central server, but you are willing to live with periods where it ... i.e. a local database or even a text file. ... to function until the connection can be restored to the server. ...
    (microsoft.public.data.ado)
  • Re: ADO Connection Timeout
    ... to the central server, but you are willing to live with periods where it ... i.e. a local database or even a text file. ... to function until the connection can be restored to the server. ...
    (microsoft.public.data.ado)
  • Re: Communicating over the internet
    ... > That way you provide one manner in which to open the database, ... > can keep the connection open and then when someone wants to ... > server as the database and the soap dll connecting with a TCP socket. ... The name of the running program might help. ...
    (microsoft.public.vb.general.discussion)
  • Re: ADO Connection Timeout
    ... much rather write stored procedures and use server side cursors. ... local database, it is vital that I get the information to a central server. ... Once the connection is restored, ...
    (microsoft.public.data.ado)