Tuesday, March 27, 2012

Connecting to sql server 2000 on Godaddy error: (provider: Named Pipes Provider, error: 40

Facts:

1. I am using my account on Godaddy trying to connect to my sql server db.

2. I can get into my db using user id and password.

3. Godaddy's help file shows this for a connection string:

connectstr = "Driver={SQL Server};SERVER=" & db_server & ";DATABASE=" &
db_name & ";UID=" & db_username & ";PWD=" & db_userpassword

4. My connection string: "Server=whsql-v09.prod.mesa1.secureserver.net;uid=dbasolutions;pwd=***;database=DB_87972;" & _
"Trusted_Connection=False providerName=System.Data.SqlClient"

{password **** out}

5. Get error message

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)

I tried to email Godaddy's help desk with this information.

There first response: We do not allow remote connections to our sql server database.

There second response was to read the help file!

Does anybody have any suggestions?

Thanks in advance,

bswanson

Finally, I did get a tech support who would give me an ear. He got this script from his tech support to test my connection:

mssqltest.aspx

<%@. Import Namespace="System.Data.SqlClient" %>
<%
Dim oSQLConn As SqlConnection = New SqlConnection()
oSQLConn.ConnectionString ="Server=whsql-v09.prod.mesa1.secureserver.net;uid=dbasolutions;pwd=*****;database=DB_87972;"
try
oSQLConn.Open()
catch dag as exception
response.write(dag.message)
End try
Response.write("Connection Open!")
%>

Now we know we are connecting to sql server!

The next issue I realized that I was facing is that the code on the server was not recompiling. It was on the 1.1 framework running on asp.net 2.0.

The code was upgraded to asp.net 2.0 and uploaded again. Still it bombed. In an effort to get it working the debugger was turned on.

The next problem turned out to be in the <compilers> . The compiler option is not allowed. After deleting this code:

compilerOptions="/define:Debug=True /define:Trace=True /imports:Microsoft.VisualBasic,System,System.Collections,System.Configuration,System.Data,System.Drawing,System.Web,System.Web.UI,System.Web.UI.HtmlControls,System.Web.UI.WebControls"

out of the compilers, it worked!

On my local machines, I have not had trouble with recompiling. But on Godaddy, it did not recompile.

Hope this can help someone. I am open to suggestions.

Thanks,

Bswanson

No comments:

Post a Comment