onfire4JesusCollins
onfire4JesusCollins

Reputation: 219

sql server connection string

I just deployed my database to my remote server. I am trying to create a connectionstring to the remote server and it won't work. I am using godaddy. I kept having this message: could not establish a connection to the database. Here is the connectionstring for the local server:

<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
  providerName="System.Data.SqlClient" />
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True"
  providerName="System.Data.SqlClient" />

Can someone help me with the connection for the remote server? Lets say my database name is collins and my password is database, and the remote hosting server=quiz.db.4423045.hostedresource.com;

Upvotes: 1

Views: 477

Answers (2)

marc_s
marc_s

Reputation: 755491

Given those connection elements you mention, your connection string ought to look something like this:

<add name="RemoteConnectionString" 
     connectionString="server=quiz.db.4423045.hostedresource.com;database=collins;
                       user id=?????;password=database;"
     providerName="System.Data.SqlClient" />

What you're missing is a user name for the connection to the database (or you didn't specify one) - you need to place that into the connection string as value for the user id= attribute.

For a great listing and explanations of all things about connection strings, you should definitely check out http://www.connectionstrings.com

Upvotes: 1

Alberto Martinez
Alberto Martinez

Reputation: 2670

First I would check that you can access ports TCP 1433 and UDP 1434 on that server (you need also the UDP port since you are using the SQLEXPRESS instance in the server).

You can check that using nmap/ZenMap (Download) or any other port scanner. The ports should be reported as open.

Upvotes: 0

Related Questions