question

Paulktl avatar image
Paulktl asked

Cannot open database.. requested by the login. The login failed. Login failed for user ‘User1′

Dear All Experts & Pro's,

Hope you can help, I been working on connecting to a MSSQL Database for days, and still can’t solve the problem. I am developing on Windows 7 64 Notebook.

I need to access (read) a database which is manage by a Commercial Software (say ‘A’), I am able to connect and work with when the Software A is not running, but when Software A is running my application cannot access the Database and vice versa.

The database is set to Multiple_User for Restrict Access. The problem is my application must run when the Software A is running.

I tested it, on its own when in Data Source (ODBC) test or in my application, it works find.

This is my connection string: MSSQL_Con.ConnectionString = “Data Source=.\SQLEXPRESS;Initial Catalog=” & TheDatabase & “;Integrated Security=SSPI;Trusted_Connection=No; Connect Timeout=30;User ID=AMS;Pwd=88888;”

I had tried Integrated Security – True / False / SSPI Trusted Connect – True or False User Instance – Tru / False

it still give me error: Cannot open database requested by the login. The login failed. Login failed for user ‘User1′ User1 is created in Management Studio and tested OK without Software A.

Please Sir/Mdm, kindly Help.

Best Regards

sql-server-2005loginmicrosoft-accessconnection-string
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Jason Cumberland avatar image
Jason Cumberland answered

Integrated security and SSPI should only be used when you are connecting with a windows account and you will not need to specify the password. Check connectionstrings.com to find the format for connecting to a SQL database using a SQL authenticated login. Possible example below:

Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;            
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.