SQL Connection error

Hi,

I'm having some problems when i try to open a connection and execute any command on my data base. When i create the mdf file on my application directory, the message error is that de file is already in use by another process. If i leave the file on the original location, the error is that i don't have permission to access the file....

Please, help me...

Tks.




Answer this question

SQL Connection error

  • Dave Jacobi

    Hi Leonardo,

    It sounds like you already have an mdf file, so you don't need to create it, you need to attach it. As you've found, you also need to have the file in a location where the Server has permission. A good location for database files is in the Data directory created during the installation of SQL Server. In a default installation this would be C:\Program Files\Microsoft SQL Server 2005\MSSQL.#\MSSQL\Data where # is the InstanceID for your SQL Server. If there is only one instance of SQL on your computer, this would be MSSQL.1.

    Once you've put the database in an accessible directory, either use Management Studio or SQLCmd to attach the database. You can find more information about attaching a database in Books Online.

    Regards,

    Mike Wachal
    SQL Express team

    ----
    Please mark your thread as Answered when you get your solution.



  • SQL Connection error