Solved

Cannot Connect to SQLEXPRESS Instance

Posted on 2011-03-24
14
1,546 Views
Last Modified: 2012-05-11
I have intstalled SQL Server Express 2008R2 on a Windows 7 computer which is in a P2P network. The router has set port forwarding to allow access through the firewall so I can address it with an address on NoIP. That seems to be working fine, at least for port 80 and I assume also for port 1433. I have opened port 1433 for both inbound and outpound traffic; set SQLEXPRESS to accept both Windows Authentication and SQL login; started the SQLServer Browser and done everything else I can find on E-E and MSDN. I still cannot connect to the instance.
This first appeared when I tried to use the Upsizing Wizard in MS Access 2003 to create the SQLServer db on the server computer. It works fine on my development computer but cannot find the instance on the other computer.
Next, I created a small database on the server (TestDB) with only three records and wrote a VB2010 program to connect to the database. No joy. The error was:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

The connection string was:

Server=http:\\tlccdb.servehttp.com\SQLEXPRESS;Database=TestDB;User ID=dick;Password=pwd

I get the same result when http:\\tlccdb.servehttp.com is replaced with my internal address of 192.168.0.192.

Suggestions on how to properly set this up would be greatly appreciated. This is for a non-profit that cannot afford hosting so we need to be able to use NoIP or a similar service. The test program is attached.
Imports System.Data.SqlClient
Public Class Form1
    Dim cn As New SqlConnection

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        rtbResult.Clear()
        Try
            Me.Cursor = System.Windows.Forms.Cursors.WaitCursor
            With cn
                .ConnectionString = TextBox1.Text
                .Open()
            End With
            Me.Cursor = System.Windows.Forms.Cursors.Default
            rtbResult.AppendText("Connection Succeeded!")
        Catch ex As Exception

            rtbResult.AppendText("Connection failed: " + vbCrLf + ex.Message)

            Me.Cursor = System.Windows.Forms.Cursors.Default
        End Try
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If cn.State = ConnectionState.Open Then cn.Close()
        cn = Nothing
        Me.Close()
        End
    End Sub
End Class

Open in new window

0
Comment
Question by:rkulp
  • 7
  • 6
14 Comments
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 35209960
Have you used the SQLExpress confuguration manager to ensure tat TCP connections are enabled (stop and start SQL service after changing)

Kelvin
0
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 35209971
Check also, in that same area that it is using port 1433 (I have seen some installation where another port was assigned
0
 
LVL 1

Author Comment

by:rkulp
ID: 35210116
Thanks for your quick response. I had already ensured that TCP connections are enabled and have looked at the error log to ensure that SQLEXPRESS is listening to port 1433.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 18

Expert Comment

by:jmoss111
ID: 35210131
check 1434 also
0
 
LVL 1

Author Comment

by:rkulp
ID: 35210225
Port 1434 is open both ways for SQLServer Browser.
I apologize for failing to mention these items (Ports 1433, 1434 and TCP connection enabled. It would have saved both of you some trouble.
0
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 35210312
I had a similar one, a few weeks back, and tracked it to some setting in the configuration manager. I cannot recall what is was (somewhere in the advanced tab). WE also turned off the firewall while testing to ensure it still wasn't in the way.
0
 
LVL 1

Author Comment

by:rkulp
ID: 35210380
Same problem with the firewall turned off. I did not find an advanced tab in the configuration manager. Will try other managers/configuration programs. MS does sprinkle them about the terrain.
0
 
LVL 1

Author Comment

by:rkulp
ID: 35228832
kelvinsparks,

I found advanced tabs on two properties dialogs. Neither showed anything I thought I should change. Several people had reported problems with connections that were the result of sqlbrowser service not running, so I did some searching about sqlbrowser even though the service is running on my computer. An MSDN article indicated it could be run in debug mode from a command line with the command sqlbrowser.exe -c. I did that and got the following error:  Failed starting SSRP redirection services  -- shutting down. So, I'm going to look in that direction. ssrpub.dll is installed on my computer. I have no idea exactly where to go or how to proceed. While I'm stumbling around, I would appreciated ideas or suggestions. Thanks for sticking with me.

Dick
0
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 35228904
If you go into the SQL Configuration Manager under the SQL Server Services, the browser service is locarted there. Can you start it from there? (Also change it to automatic - if not already that)

Kelvin
0
 
LVL 22

Accepted Solution

by:
Kelvin Sparks earned 500 total points
ID: 35228920
Also, under the SQL Server Network configuration, under the IP addresses, look right to the bottom. IP ALL port is possibly set to 1031, note whatever value it is so you can go back to it. Try changing to 1433. the in the services stop and start the SQL Server service.

Kelvin
0
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 35228922
Above comment, you need to double click on TCP/IP to get there
0
 
LVL 1

Author Comment

by:rkulp
ID: 35231376
Kelvinsparks,

The browser service was already running. I had set the IPALL to 1433 but upon looking, it was blank so I reset it. The problem persists. However, I traced packets using WireShark and noted that access was denied. There must be something about the username and password that is being rejected. I'll post progress here.  Thanks.

Dick
0
 
LVL 1

Author Comment

by:rkulp
ID: 35231501
Success! I am embarassed to say that when I reset the IPALL it was on the wrong computer. Just a senior moment with the KVM switch. When I did it again and altered the connection string to point directly to the internal IP address, I got denied saying the password needed changing. Hot Dog! Changed that and the connection succeeded. Went back to the NoIP address and with a slight modification, that worked. Thanks for all your help.
0
 
LVL 1

Author Closing Comment

by:rkulp
ID: 35231509
You have been very patient with me. Thanks for all your help.
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question