Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 An error has occurred while establishing a connect

Author  Topic 

josephl
Starting Member

12 Posts

Posted - 2008-03-02 : 18:24:20
Hi,
I'm developing an ASP website with components developed under C# (DLL). The component is working ok when I temporarily used winforms to test it prior to compiling to DLL. but when I used that component to a ASP script, I got the 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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"

It is weird because I'm not using SQLServer 2005. I'm using MSSQL 2000 only. If the winform version is working ok, how come the asp version is not? all the proper registration of component was followed correctly (even though it sucks. i used to developed a component in VB6 before and I never encountered so many authentication crap unlike in .Net2.0)

Can someone help me on this?

Thank you in advance.

Joseph

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-03-02 : 20:01:57
Did you have correct connection string?
Go to Top of Page

josephl
Starting Member

12 Posts

Posted - 2008-03-02 : 22:40:19
Hi rmiao,
Yep, the connection string i used in the form version was the same as the connection in the ASP script:
==================================
Data Source=SIRIUS\\EPHARMACY;Initial Catalog=ePharmacy;Persist Security Info=True;User ID=james;Password=bond
=============================
And the ASP script was:

===========================
connSTR="Data Source=SIRIUS\\EPHARMACY;Initial Catalog=ePharmacyDev_ADHB_20070228;Persist Security Info=True;User ID=devuser;Password=bond"

Set objSearch = Server.CreateObject("Search.Patient")
sResult = objSearch.ListPatients(surname, connSTR)
Set objSearch = Nothing

response.write sResult
================================

Thanks in advance

Joseph
Go to Top of Page

josephl
Starting Member

12 Posts

Posted - 2008-03-02 : 22:42:14
Correction: The ASP script was:
Data Source=SIRIUS\\EPHARMACY;Initial Catalog=ePharmacy;Persist Security Info=True;User ID=james;Password=bond
Go to Top of Page

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2008-03-02 : 23:04:27
quote:
Originally posted by josephl

Correction: The ASP script was:
Data Source=SIRIUS\\EPHARMACY;Initial Catalog=ePharmacy;Persist Security Info=True;User ID=james;Password=bond



LMAO...I was going to suggest that you didn't have to post the passwords and login info...

Change the settings on the server to allow remote settings.



Poor planning on your part does not constitute an emergency on my part.

Go to Top of Page

josephl
Starting Member

12 Posts

Posted - 2008-03-03 : 14:30:08
Hi Lamao,
No problems on the password infos. The server has numerous firewalls installed (pix/personal fw).
What application server should I change? The SQL server application or the windows server in which the SQL DB resides? I already change the SQL server settings to accept remote connection. I will try then the server itself. Update you later. thanks
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-03-03 : 22:40:31
Tried connect to sql with ip address and port number?
Go to Top of Page

josephl
Starting Member

12 Posts

Posted - 2008-03-17 : 20:46:03
Thank you guys. It's running fine right now. It was actually pix firewall issue.
Go to Top of Page

shijobaby
Starting Member

44 Posts

Posted - 2009-07-17 : 02:34:13
Hi

i was also facing the problem when connecting sql server 2005 with sqlconnection then i also got the following error message

Sqlcmd: Error: Microsoft SQL Native Client: 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.

I referred the following url and solved

http://sqlservererror-info.blogspot.com/2009/07/error-has-occurred-while-establishing.html

Regards
Go to Top of Page

tripodal
Constraint Violating Yak Guru

259 Posts

Posted - 2009-07-17 : 11:09:11
If it was a firewall issue, you should probably change your password now... since the firewall is letting people through.

But thats just me...
Go to Top of Page
   

- Advertisement -