views:

35

answers:

2

I have a Gui running on a server with the IIS and the SQL database both on the same machine.

I have this connectionstring in the webconfig.

Data Source=localhost\SQLEXPRESS;Initial Catalog=XYZDB;Integrated Security=True

Now i want to access another database on a different server, i thought it would just take me to change "localhost" to the machine server name, but that is not working.

any idea how should i go about doing this..

Any help is greatly appreciated

Thank you.

Error message:

Exception Details: System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

+3  A: 

I would check to make sure that you instance of SqlExpress will accept outside connections:

http://blogs.msdn.com/b/sqlexpress/archive/2005/05/05/415084.aspx

Kevin
i enabled the remote connection still the above error is showing... may be its not able to access that server
The other thing I would check is that you need to make sure that your account accessing that sql server has rights on the new machine. I would guess you are a using an account local to the machine with IIS on it.
Kevin
im looking into it.. thanks
Hey how do i check the account accessing that sql server has rights on the new machine. yes my account will be on the machine where the IIS is. You are being really helpful.. hope this works... thanks
I'll admit I just skimmed the article, but I think this will point you in the right direction: http://msdn.microsoft.com/en-us/library/bsz5788z.aspx
Kevin
ok i made some fire wall changes but now i get this error:
Login failed. The login is from an untrusted domain and cannot be used with Windows authentication
oh...you're going cross domain. Truthfully, I would switch the connection string to use SQL Server authentication. It's going to be a lot easier than doing cross domain trusts with Active Directory.
Kevin
true, even i dont want to use active directory... im figuring out a way to do so.
if u have a link to share abt how to use SQL server authentication it could be of help.. but anyways iv given u the correct answer coz most of it worked and i think im close to solve it... thanks
this should show the connection string etc: http://msdn.microsoft.com/en-us/library/ff648340.aspx
Kevin
+4  A: 

In Data Source, localhost is the name of the server and SQLEXPRESS is the named instance of SQL running on that server.

So either you do not have a named instance on the new server or the named instance is different.

OR like Kevin said, your instance is not accepting outside connections.

Tony Abrams