Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Sep 2009
    Posts
    31
    Thanks
    2
    Thanked 1 Time in 1 Post

    Accessing Remote Database from Windows Form APP

    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);
    connection.Open();

    From my database page

    Server: name.db.5003672.hostedresource.com (IP2 via TCP/IP)
    User:name@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

    IP2
    name.db.5003672.IP2

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

  • #2
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    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.
    OracleGuy

  • Users who have thanked oracleguy for this post:

    MattNolan (10-02-2009)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •