Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Detached Sqlexpress Cannot Login! Help!

Author  Topic 

BellaScout
Starting Member

25 Posts

Posted - 2009-02-20 : 11:51:03
I detached a SQL Server database in order to deploy it locally but getting login password error.

Here is the connectionstring I'm trying to use for the detached database:


<add name="ConnectionString" connectionString="Server=.\SQLExpress;AttachDbFilename=|DataDirectory|APP_DEV_V1.mdf;User ID=APP_USER;Password=app" providerName="System.Data.SqlClient"/>

I can connect fine directly to sql server using this string:
connectionString="Data Source=DBSERVER;Initial Catalog=APP_DEV_V1;Persist Security Info=True;User ID=APP_USER;Password=app"

I tried connecting within VS Server Explorer but get same error which kinda tells me the connection string is not the issue? What do you have to do to logon using SQL Authentication within a sql express database file?


Help!

mfemenel
Professor Frink

1421 Posts

Posted - 2009-02-20 : 13:27:25
What is the error you're getting? You're not trying to connect to the detatched db are you? Also, what login are you using and is it's default database set to the database you've detatched?

Mike
"oh, that monkey is going to pay"
Go to Top of Page

BellaScout
Starting Member

25 Posts

Posted - 2009-02-20 : 14:40:17
I modified the registry following this post advice:
http://sqlservernotes.blogspot.com/2007/06/enabling-sql-authentication-in.html

and I changed the service Log On to "Local System Account" and got a little farther but now have this error:

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

Go to Top of Page

BellaScout
Starting Member

25 Posts

Posted - 2009-02-20 : 14:58:21
To answer your question...yes, I'm trying to connect to the detached database as a sqlexpress file. The issue is connecting using sql authentication.
Go to Top of Page

BellaScout
Starting Member

25 Posts

Posted - 2009-02-20 : 15:25:52
What is interesting is I can connect using the sql user in sqlexpress through Server Management Studio but I cannot connect within visual studio. The connection defaults to User Instance = True within Server Explorer of Visual Studio. If I set User Instance to False and try the connection again, I get this error:
"An attempt to attach an auto-named database for file c:\.... failed. A database with the same name exists, or pecified file cannot be opened, or it is located on UNC share."

Go to Top of Page

BellaScout
Starting Member

25 Posts

Posted - 2009-02-21 : 14:12:03
My issue was resolved with the help of msdn forum if anyone is interested:

http://social.msdn.microsoft.com/Forums/en-US/sqlexpress/thread/6764e959-4a32-49e3-ae84-61471d6a105a
Go to Top of Page
   

- Advertisement -