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.
Author |
Topic |
Hossein
Starting Member
3 Posts |
Posted - 2013-02-25 : 14:58:33
|
Hello I am trying to use SQL Authentication to connect to a database .I am having extreme difficulties and my searches so far couldn't help me solve the problem.I Enabled the SQL Authentication through SQL SERVER MANAGEMENT STUDIO and enabled sa and set a simple password for it.(under .\sqlexpress - i mean my server-name is ). Now I can Successfully log in to the database by sa and its password from SQL SERVER MANAGEMENT STUDIO but when i try to do so from my application it fails with this error message :quote: Cannot open database "dbNegin" requested by the login. The login failed. Login failed for user 'sa'.
I need to say that i changed the database owner to sa as well, yet i get this error!!How can i solve this now? :(By the way this is the connection string used in my application to connect to the database :quote: string sqlconstring = @"Data Source=.\sqlexpress;User ID=sa;Password=123456;Initial Catalog=dbNegin";
My data base is attached by the way (its located in the address below )quote: " D:\TestDb\Debug\dbNegin.mdf"
And this is the latest error log:quote: 2013-02-25 21:51:18.59 spid51 Attempting to load library 'xpstar.dll' into memory. This is an informational message only. No user action is required.2013-02-25 21:51:18.59 spid51 Using 'xpstar.dll' version '2007.100.1600' to execute extended stored procedure 'xp_instance_regread'. This is an informational message only; no user action is required.2013-02-25 21:51:20.80 spid51 Starting up database 'C:\USERS\FRIEND\DESKTOP\RELEASE\DBNEGIN.MDF'.2013-02-25 21:51:21.33 spid51 Starting up database 'mytestdb'.2013-02-25 21:51:21.60 spid51 Starting up database 'C:\USERS\FRIEND\DESKTOP\RELEASE\DBNEGIN.MDF'.2013-02-25 21:51:35.60 Logon Error: 18456, Severity: 14, State: 38.2013-02-25 21:51:35.60 Logon Login failed for user 'sa'. Reason: Failed to open the explicitly specified database. [CLIENT: <local machine>]2013-02-25 22:11:00.79 Server Server resumed execution after being idle 246 seconds: user activity awakened the server. This is an informational message only. No user action is required.2013-02-25 22:11:00.97 spid51 Attempting to load library 'xplog70.dll' into memory. This is an informational message only. No user action is required.2013-02-25 22:11:01.04 spid51 Using 'xplog70.dll' version '2007.100.1600' to execute extended stored procedure 'xp_msver'. This is an informational message only; no user action is required.2013-02-25 22:57:29.06 spid53 Starting up database 'C:\USERS\FRIEND\DESKTOP\RELEASE\DBNEGIN.MDF'.2013-02-25 22:58:40.51 Logon Error: 18456, Severity: 14, State: 38.2013-02-25 22:58:40.51 Logon Login failed for user 'sa'. Reason: Failed to open the explicitly specified database. [CLIENT: <local machine>]2013-02-25 23:07:09.86 Logon Error: 18456, Severity: 14, State: 38.2013-02-25 23:07:09.86 Logon Login failed for user 'sa'. Reason: Failed to open the explicitly specified database. [CLIENT: <local machine>]2013-02-25 23:07:16.37 Logon Error: 18456, Severity: 14, State: 38.2013-02-25 23:07:16.37 Logon Login failed for user 'sa'. Reason: Failed to open the explicitly specified database. [CLIENT: <local machine>]
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2013-02-26 : 01:54:20
|
can you confirm the default database set for the logon and the explicit catalog defined in the connection string are available and the logon account has access rights to those 2 databases?Jack Vamvas--------------------http://www.sqlserver-dba.com |
|
|
Hossein
Starting Member
3 Posts |
Posted - 2013-02-26 : 02:34:30
|
quote: Originally posted by jackv can you confirm the default database set for the logon and the explicit catalog defined in the connection string are available and the logon account has access rights to those 2 databases?Jack Vamvas--------------------http://www.sqlserver-dba.com
Thank you very much for your answer. The problem was all you have just mentioned :) The following thread solved my problem and here is the link for further references: quote: http://www.sqlservercentral.com/Forums/Topic1423758-391-1.aspx?Update=1
|
|
|
sebantom1979
Starting Member
6 Posts |
Posted - 2013-03-05 : 07:45:53
|
http://answerforu.com/2011/09/26/cannot-open-database-requested-by-the-login-the-login-failed-login-failed-for-user-%e2%80%98usename/ |
|
|
|
|
|