Remote Connection to SQL Server

CoachBarker

Well-known member
Joined
Jul 26, 2007
Messages
133
Programming Experience
1-3
When I run my app at work it runs fine either on my workstation or on my laptop which is not on the domain, but when I run it at home I get this error message. I am logged into the VPN so I am told I should be able to connect to the database. One question I had was that they have at work one database that is remotely connected to under a heading of remote connections, shouldn't this database be in that category too?

SQLError3.jpg

All we are trying to do is to load a list of applications available on certain computers that are in this database to the app I am running. The error message is thrown at da.Fill(ds, "Apps")

VB.NET:
Sub loadApps()
        ' When the form loads get all the names of the applications that are installed on the computers
        ' Declarations of variables
        ' String to hold the SQL String
        ' A new DataSet
        ' A new SqlDataAdapter passing in the sqlString and database connection 
        Dim strSQL As String = "SELECT * FROM Applications ORDER By AppName"
        Dim ds As New DataSet
        Dim da As New SqlDataAdapter(strSQL, myConn)
        Try
            ' fill the dataset
            da.Fill(ds, "Apps")
            ' loop until all apps are returned
            If ds.Tables("Apps").Rows.Count > 0 Then
                cblApplications.DataSource = ds.Tables("Apps")
                cblApplications.DisplayMember = "AppName"
                cblApplications.ValueMember = "AppID"
            End If
        Catch ex As Exception
            MsgBox("Error" & ex.ToString)
        End Try
    End Sub

We have tested the connection string and it is valid.

Any suggestions
CoachBarker
 
Er, you mean you tested the connection at work?

As the error says, by default SQLServer doesnt use named pipes or allow remote conenctions.. Use the SQLServer SUrface Area COnfiguration tool to enable those and try again. Also, ensuring the SQLServer browser service on the remote amchine is started will help the client discover the available datbases on the remote machine, if you are rebuilding your connection string.

Dont forget that if youre using a VPN you may be subject to network security restrictions including port blocking, ip range blocking, different network subnets, gateway restrictions etc..

I'd try telnetting to port 1433 on the db server. if your telnet doesnt connect, ..NET wont either
 
Even though they have another app that does connect in the same fashion to another SQLServer database? Unfortunately my training in SQLServer is at a minimal level and right now I am working with the web developer who thinks this should be working (this is not a web app).

Will relay your response to him and see what he thinks. If we are lucky we can get 5 minutes with the System Architect to look this over, but he has been just way to busy with other things to look into it.

How do I telnet into the port? Will give that a try.

Thanks
CoachBarker
 
From the machine that is failing:

Start
Run
CMD.EXE
OK
c:\> telnet mysqlserverhostname 1433
 
cjard

We are using SQLServer 2000, would that make a big difference? When I posted originally I thought we were using 2005.

CoachBarker
 
Back
Top