Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
|
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 8th, 2007, 03:43 PM
Authorized User
 
Join Date: Apr 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to DudeBori82 Send a message via MSN to DudeBori82
Default Remote connection error with SQL Server Express

I've been trying to configure remote connections to my sql server express to no avail.

First here are some constants to clear some things up:
- OS: Windows XP Pro
- SQL Express version: April CTP release
- Windows Firewall: disabled (to avoid any problems there)
- Network type: two computers connected a router.
- Router firewall: Enabled (I may be wrong but the router firewall only blocks external traffic, so I left it on.)

First, I configured my SQL server to allow remote connections in the SQL Surface Area Configuration. (Set it to both TCP/IP and named pipes)

Second, I enabled and configured sql server browser.

Third, I enabled TCP/IP and named pipes in the 'Protocols for SQL Express' option of the SQL Server Configuration Manager.

According to http://blogs.msdn.com/sqlexpress/arc...05/415084.aspx
I have done everything I need to (including edit the registry to enable the SQL Server Browser service) and the error I continue to get is:

"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (Microsoft SQL Server, Error: -1)"

So I tinkered and had no success in messing with anything that would fix it. Although, ***when I browsed for network servers on my non-sql server machine, the instance DID show up in the list***. So I find it odd that it can find the instance when browsing, but fails to 'find' it when making a connection.

So I didn't stop there, I decided to try the non-sql server browser method of remotely connecting: specifying the IP.

I went back to the blog of instructions referenced above and re-did the steps, this time specifying a TCP Port for the server instance and then after specifying the port on the remote computer connection string, and attempting to connect, I get this error:

"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.) (Microsoft SQL Server, Error: 10060)"

I've done all I know how, read all the possible blogs I can, and nothing's come up. If anyone can shed some light on me, I'd pay you 1 billion pretend dollars. :) Any help would be appreciated. Thank you!

Troubleshooting life: 1 bug at a time.
__________________
Troubleshooting life: 1 bug at a time.
 
Old September 26th, 2007, 02:15 PM
SQLScott's Avatar
Wrox Author
 
Join Date: Dec 2004
Posts: 338
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Take a look at this:

http://blogs.msdn.com/sqlexpress/arc...05/415084.aspx



Scott Klein
Author - Professional SQL Server 2005 XML
http://www.wrox.com/WileyCDA/WroxTit...764597922.html
 
Old July 14th, 2008, 06:46 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I seem to have a similar problem, which I cannot overcome. If someone have a solution please help...

I have configured by SQL Server Express to allow remote connections, and I can in fact connect to it from a remote machine through SQL Server Management Studio Express using a connection string like...
Code:
tcp:[domain]\SQLEXPRESS,1500
However, when I have to connect to the same server through a connection string the connection fails with the following message...
Quote:
quote:System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)
I have tried millions of different connection strings but do not get any further. Here is my best suggestion...
Code:
Data Source=[domain]\SQLEXPRESS,1500;
Network Library=DBMSSOCN;
Initial Catalog=[database];
User ID=******;
Password=******;
Trusted_Connection=False;
But this doesn't work either. I tried the tcp: prefix as well, but I guess that isn't needed in the connection string.

What do I do wrong?

Thanks, Jacob.

Last edited by jacob; March 18th, 2009 at 01:17 PM..
 
Old July 14th, 2008, 07:19 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ups... I found the solution my self...

I forgot to ensure that the port (1500) was opened from the remote site from which I was trying my connection string. I validated that I was able to connect through SQL Server Management Studio Express from another machine than running the connection string from.

FYI... the connection string above will in fact work.

Thanks anyway, Jacob.
 
Old April 12th, 2009, 01:51 AM
Authorized User
 
Join Date: Jul 2007
Posts: 24
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hello Friends

Error Desciption:
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)


Error says problem in remote connection...I have checked dozen of posts of net, giving remedies of remote connection, which is not helping my cause. I have followed each and every step of remote connection, the connection is already enabled. But still the problem persists. Friends please help. I have to submit my major project, all was done until this problem happened. Please solve my problem urgently, please. Some posts say there is a problem in connection string.

Here is the code:
public void connected()
{
con = new SqlConnection("data source=CR32; trusted_connection=yes; database=credit_scoring");
//con.Open();
}
public int login()
{
connection obj = new connection();
obj.connected();
obj.con.Open();
obj.cmd = new SqlCommand("proclogin",obj.con);
obj.cmd.CommandType = CommandType.StoredProcedure;
obj.cmd.Parameters.AddWithValue("acc",acc_no);
obj.cmd.Parameters.AddWithValue("pass",pass);
SqlParameter sp = new SqlParameter();
sp.ParameterName = "@count";
sp.DbType = DbType.Int32;
sp.Direction = ParameterDirection.Output;
obj.cmd.Parameters.Add(sp);
obj.cmd.ExecuteNonQuery();
int flag = Convert.ToInt32(sp.Value);
return flag;
}
Friends I have made a dll file and calling the class of this file to use the above two functions. I think the problem is in datasource, please tell me the appropriate remedy. I have tried of setting datasource as local, but still the problem persists.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Remote Access to SQL Server Express Bob Bedell .NET Web Services 6 December 21st, 2007 10:50 AM
SQL Server remote connection error sterreyl ASP.NET 2.0 Basics 1 April 6th, 2007 07:17 PM
SQL Server Express Connection String dkaufmann VB Databases Basics 4 November 3rd, 2006 01:48 PM
Problem with my sql server express connection saif44 ASP.NET 2.0 Basics 9 June 13th, 2006 05:07 PM
VB Express and SQL server on remote server questio HoosierDaddy61 Visual Basic 2005 Basics 0 February 22nd, 2006 11:27 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.