Hi,

I have hosted a website that has MSSQL Server 2005 database on different machine. I am using the following connection string

<add name="ConnectionString" connectionString="Server=mssql2005.ableos.com.au;Database=visualinventory_ableos_com_au;Uid=myuserid;Pwd=mypassword;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />

I am getting the following error.

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)

What may be the potential problem. ?

I am able to connect to the same database using same user id and password through third party software that allows me to monitor it. why my website is not able to connect to it ?

Any suggestion appreciated.

This should resolve the problem.

Visual Studio => Tools => Options => Database Tools => Design Time - Validation Database => Connection options

Set the sql server instance name to Blank. Please check if this works.

Your connection string has a problem.. If you are using Integrated Security=True then you should not specify a user name and password.

Also I think "uid=" is only valid for an MSSQL connection string if you are using the ODBC driver. I don't think it is valid for Native SQL Client?

Set the connection string as:

<add name="ConnStr" connectionString="Data Source=apex2006sql;Initial Catalog=Bugs;Integrated Security=False;User Id=?username?;Password=?password?;" providerName="System.Data.SqlClient" />

or

<add name="ConnStr" connectionString="Data Source=apex2006sql;Initial Catalog=Bugs;Integrated Security=True;" providerName="System.Data.SqlClient" />

Yes i think the above poster is right. Also check that Sql server configuraton allows remote connection. To do that follow the steps below:

Click Start -->> Programs -->> Microsoft SQL Server 2005 -->>
Configuration Tools -->> SQL Server Surface Area Configuration.
Now click Surface Area Configuration for Services and Connections.
Now expand Database Engine, click Remote Connections, click Local and remote connections, click the appropriate protocol to enable for your environment, and then click Apply.

Restart MSSQLSERVER service from
Start -->> Control Panel -->> Administrative Tools -->>
Service -->> Select MSSQL Server -->> Restart Service

Thankx for your suggestion.

It resolve the issue with both IIS and SQL Server 2005 on same machine.

Great, I'm glad to see you got it working!

Please mark this thread as solved if we have answered your question.

Thanks for posting an informatics code about database connections.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.