Database Connection Problems

J

Jonathan Wood

I'm new to SQL Server and seem to have a lot of problems with my connection
string not working. I finally got it working on one system but then it
stopped working when I moved to another system. Can anyone give me some
ideas as to why?

IMPORTANT: This is not on the final Web-hosting machine. I'm just trying to
get it running on my production machine for development and testing.

My current connection string is "Server=.\SQLEXPRESS;Integrated
security=SSPI;Initial Catalog=BlackBelt".

Which gives me the error "Cannot open database "BlackBelt" requested by the
login. The login failed. Login failed for user 'Jonathan-PC\Jonathan'."

I'm running as an administrator on Vista and, when I right-click on the
database (BlackBelt.mdf) in the Server Explorer and select the Modify
Connection command, I see 'Use
Windows Authentication' is selected, for which I obviously have correct
authentication. And if I click 'Test Connection' from this same dialog, it
reports that the connection succeeded.

I have SQL Server Express installed and SQL Server Configuration Manager is
setup as follows:

SQL Server 2005 Services
- SQL Server (SQLEXPRESS) = Running
- SQL Server Browser = Stopped
SQL Server 2005 Network Configuration
- Protocols for SQLEXPRESS
- Shared Memory = Enabled
- Named Pipes = Disabled
- TCP/IP = Disabled
- VIA = Disabled
SQL Native Client Configuration
- Client Protocols
- Shared Memory = Enabled
- Named Pipes = Enabled
- TCP/IP = Enabled
- VIA = Disabled
Aliases
(Empty)

I was able to get it working with the connection string "Data
Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Jonathan\Documents\Visual
Studio 2005\WebSites\BlackBelt\App_Data\BlackBelt.mdf;Integrated
Security=True;User Instance=True" but I have no idea why and some folks told
me that there are problems connecting with User Instance = True.

I don't get why I'm having so much trouble with this. Any suggestions
appreciated.
 
C

Cor Ligthert[MVP]

Johnatan,

Are you sure that you have integrated rights on that other machine. In my
expirience that is the most common problem. You can maybe make a connection
with SQL authentication.

Cor
 
J

Jonathan Wood

It looks like I have this figured out thanks to help from someone else.

I didn't really understand your reply. Not only am I not sure I have
integrated rights on the other machine, but I have no idea what that means.
And I don't get the comment about SQL authentication either.

What I didn't understand before (and wasn't made clear in the many related
discussions I've had), is that you can create a database that is not
attached to the SQL server. The common connection strings I've encountered
only work when the database is provided by the SQL server. Otherwise, you
need to use AttachDbFilename. I'm still not sure about User Instance, but I
can figure that out in good time.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top