susja
susja

Reputation: 321

Connection string for SQL Server Express 2014

On Win 7 system I installed SQL Server 2014 Express. I created instance HM1. I've set it up to use mixed mode. I created a SQL Server user and I am able to login with no issue.

My goal is to connect to a database using this SQL Server user using configuration file. This connection will be used for another application. Note: if I disable user/password usage during login I have no problem but I have to use credentials.

For connection I provided machine_name\SQLSERVEREXPRESS\HM1. I also provided username and password. I also changed the service for SQLEXPRESS and HM1 to run as local account.

When I try to connect using that file I've got the error

Can't connect to database

Again if I disable user/password usage I am able to connect using the same file with no problem.

Could someone help me with it?

Thanks

Upvotes: 0

Views: 13446

Answers (2)

Suhaib Syed
Suhaib Syed

Reputation: 86

You need to put the un-encoded password in the config file instead of the base64 encoded one. Alternatively, you can also put Trusted_Connection=True; in the connection string if your database server resides on the same server as the application server. This will use the OS credentials instead of the username/password that you provide.

Upvotes: 1

Joel Coehoorn
Joel Coehoorn

Reputation: 415705

For connection I provided "machine_name\SQLSERVEREXPRESS\HM1".

You just want this:

machine_name\HM1

That's probably not your only problem, but that's all I can tell you until you try that and then come back and include more detail from the error message.

Upvotes: 1

Related Questions