Accessing the same SQL Server database from 2 client applications can't achieved

1.3k Views Asked by At

I've developed a C# Linq to SQL accounting program. It has an SQL Server 2008 Express Edition. The program worked fine for one client, but when I tried to create a second client on another computer, although I have enabled remote access for the DB, I have noticed that accessing the DB by the two clients at the same time doesn't happen! just the first client who requested the DB can access it, and the other one couldn't until I close the application on the first one.

I've tried to create a new SQL USER (Login) for the other computer, but the same error occurs.

The full exception message is: Cannot open database "XXXX" requested by the login. The login failed. Login failed for user 'USERNAME' END OF THE ERROR MESSAGE

Thankfully hope to solve my issue.

2

There are 2 best solutions below

1
On

Check your Maximum number of concurrent connections in your Server Properties. 0 = unlimited. It's possible it's been set to 1. (Right-click context menu on your server from SQL Server Management Studio.)

1
On

I've tried to create a new SQL USER (Login) for the other computer, but the same error occurs.

You mean COMPUTERNAME$? (with COMPUTERNAME being the name of the computer - and yes, this is followed by a $) THAT (and only that) ould be a computer account - and would require the computer to log on with SYSTEM identity, not with user identity.

The error message is clear:

The login failed. Login failed for user 'USERNAME' END OF THE ERROR MESSAGE

Create a login for the speific user the user uses - either his domiain account (if you use trusted login) or the user name he is supposed to type in. Then give this user rights on the database.

it is also possible you botched up the connection strings or put your databae in single user mode (whjich is an option for times the admin wants to be alone, like during updates).