Sunday, February 19, 2012

Cannot connect to SQL Express db with visual c++

I've installed both SQL Server Express and Visual C++. I'm trying to connect to a SQL database, but keep receiving various errors. This is what I've done so far.

1. Eventually, I used the surface area manager to allow a remote connect.

2. The server and my development environment exist on the same virtual machine, I created with Virtual Pc.

3. I'm running Vista as my operating system.

4. My Data Source wizard looks like this:

Data Source: MS SQL Database File

Database file name: C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\ETS.mdf

If I use Windows Authen I get the following error:

Unable to open physical file "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\ETS_log.ldf" Operating System Error 5: (Access is Denied). An attempt to attach to an auto-named database for file C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\ETS.mdf failed. A database with the same name exist , or specified file cannot be opened, or it is located on a UNC share.

If I use SQL Server Authen I get the following error:

Failed to generate a user instance of SQL Server. Only an integrated connection can generate a user instance. The connection will be closed.

I'm new to this. I really would like help in knowing what these errors mean and how to get pass them. But this is very, very, very, frustrating. First off, there was no instructions on allowing remote connections. I stumble upon it myself. Giving permission to the file, stumble upon myself. I spent 4 days with a You do not have permission to open file error. Didn't realize I didn't have permission.

I need a step by step on what to do. I can be emailed at gregw.energytaxsolutions@.hotmail.com if need be.

If this is in the wrong place, moderator please move to the correct area.

Redirected from visual c++ express forum to SQL Server Express forum.

In case you are disagree with the movement, please feel free to point it out so that we can have further discuss.

|||

hi,

you are using the User Instance feature of SQLExpress edition and this "method" only supports Windows authenticated connections and not mixed mode connections with standard SQL Server logins...

the other problem regards the permissions on the folder containing the referenced database file... the path must be accessible by the user instance.. please read the linked article about that..

regards

|||Thank you for the direction to the article, it was really informative (although I didn't quite understand everything it was talking about). I did get the overall jist of what it was trying to tell me. I have a lot to learn. If anyone knows of a good source of where to start, I would really appreciate it.|||

hi Gregw,

additional information about User Instances can be found at http://msdn2.microsoft.com/en-us/library/ms143684.aspx, http://msdn2.microsoft.com/en-us/library/ms345154.aspx, http://msdn2.microsoft.com/en-us/library/ms254504.aspx..

regards

No comments:

Post a Comment