Drop Database

DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Drop Database

  1. #1
    Join Date
    Sep 2006

    Drop Database

    (I use C++ builder, ADO and SQL Server)
    While executing SQL query "DROP DATABASE test" an error message appears "Cannot drop the database 'test' because it is currently in use". I just can't find what uses this database else. How to "kill" it using code and succesfully drop database?

  2. #2
    Join Date
    Nov 2004
    To capture the set of SPIDs connected to the server and the associated DB use the sp_who2 system stored procedure.

  3. #3
    Join Date
    Dec 2003
    its probably a service -- look and see if you have any database services running and terminate them (they will restart when you reboot windows if you kill but do not change the settings). Services are in the control panel, sometimes under admin tools.

  4. #4
    Join Date
    May 2006
    I think you and your code is that user who is connected to the database and therefore blocks the DROP DATABASE operation. Probably it is not possible to execute this statement using ADO in usual manner.

    I suppose you start ADO operations by creating a "connection" object based on a "connection string". Usually this string specifies the database to be accessed. Therefore the created connection object locks this database.

    Maybe it is possible to create a connection using shorter connection string, without attaching to any database? In this way perhaps the DROP DATABASE will work.

Similar Threads

  1. unable to read data from database
    By dppalepu in forum Java
    Replies: 2
    Last Post: 07-27-2006, 03:15 AM
  2. Replies: 2
    Last Post: 12-08-2002, 07:20 PM
  3. Really Cool 3 tier Java database solution
    By Russ in forum Database
    Replies: 0
    Last Post: 06-04-2002, 12:57 AM
  4. Database Security General Discussion
    By Michael Tzoanos in forum Database
    Replies: 0
    Last Post: 04-12-2002, 11:19 AM
  5. Multiple Database Architecture
    By mholt28 in forum VB Classic
    Replies: 1
    Last Post: 06-05-2000, 11:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center