View Full Version : Accessing Remote Database from Windows Form APP

10-02-2009, 01:19 AM
I'm having a lot of trouble on a personal side project of mine connecting to a remote database from my windows form application.

Right now I am getting a

System.Data.SqlClient.SqlException A network related or instance specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible.

How do I know if my database is set up to allow remote connections?

Heres my code:

static SqlConnection connection;
string connectionString = "Server=name.db.5003672.hostedresource.com; Database=name; UId=name@IP; Password=password;";

connection = new SqlConnection(connectionString);

From my database page

Server: name.db.5003672.hostedresource.com (IP2 via TCP/IP)

the actual octets have obviously been changed to IP and IP2 and the name has been changed to name and password to password

I have also tried these changes to the connectionstring server


Hopefully anybody can have any type of insight for me, I am new to databases and connectionstrings in particular.

10-02-2009, 06:03 PM
Remote connections would be part of the server configuration. Furthermore, if the server is behind a firewall, you need to make sure that the port used for SQL Server is opened so you can connect in.

It probably isn't a problem with your connection string and a network or server configuration issue at the other end.