Question Sql Server 2008 Client Connection Problem...Need Help!!!

vbnewbee

Member
Joined
Oct 26, 2011
Messages
5
Programming Experience
1-3
Hi,

I am handling a project where the client wants a client/server application which should run on local network. Now, in the development environment I am unable to connect to the Sql server from the other machine. Sql server is on the server machine(windows 7) where i tried to remove firewall and made static ip based network.
To connect to the database I used the connection string as below

connString="Server=xxx.xxx.xxx.xxx,1433;database=dbname;integrated security=true;user id='server machine name\administrator';password='server's administrator password';

This is working fine on the server machine. When I run the same application from the other machine itz posing an error:

Cannot login using 'server machine name\guest' account.

I used windows authentication on the server. Even, I enabled TCP/IP and provided the IP address of the Server Machine.

Can anyone please guide me with a good solution for this problem.

Thankyou.
 
I think that you misunderstand how Windows authentication works. When you set Integrated Security to True in your connection string, you are saying that you want to use Windows authentication. That means that you are connecting as the current Windows user, not as any Windows user you care to specify. When Integrated Security is True, the User ID and Password properties are ignored and the connection is made as whatever user the current process is running as. You must run your process as a user for which there is a corresponding login in SQL Server, otherwise you must use SQL Server authentication, i.e. set Integrated Security to False (which is the default).
 
Hi Dear jmcihinney,

Thank you for your kind solution. This is working fine on the local machine where the sql server was residing buh, when I publish the same and install on the other machine I'm greeted with the same error that: Login failed for the User Server Machine Name\Guest...

Can you please tell me what should I do to resolve this issue. I am deep in trouble now. Please lead me to a good solution.

Thanks in advance.

regards
 
The answer is very simple: at any particular time, you have to use a valid connection string. If you need to use a different authentication method and/or different credentials at different times then you have to change the connection string appropriately.
 
Back
Top