Error connecting to SQL Server Express 2008 R2

I get the following error:
Error:
Cannot create PoolableConnectionFactory (The connection to the host localhost, named instance SQLEXPRESS has failed. Error: “java.net.SocketTimeoutException: Receive timed out”. Verify the server and instance names, check that no firewall is blocking UDP traffic to port 1434, and for SQL Server 2005 or later verify that the SQL Server Browser Service is running on the host.)

I left the default instance name of SQLEXPRESS. I am using jdbc:sqlserver://localhost\SQLEXPRESS as the Connect URL. I am using the default “sa” account for the login with the password that I created.

I have enabled the TCP/IP protocol, started the SQL Server Browser service, and made sure that “Allow Remote Connections” is checked. I have Windows Firewall turned off.

It seems that I have everything set up correctly according to the information that I could find but it is not working so I must have missed something.

1 Like

Oh, and I also made sure that mixed mode authentication is on and that I can log into the database using the Management Studio with the “sa” account.

Try moving the instance name to the “extra connection properties”
e.g.
instanceName=SQLEXPRESS

I seem to remember having to do that when I first started on a development machine wth SQL express.

I just gave that a try but I get the same result.

Just out of Curiosity, the PC you are running this on is connected to a network while you are trying to connect using “localhost” ?

It is just connected to my home wireless at the moment for internet.

Also check that “Shared Memory”, “TCP/IP”, and “Named Pipes” are enabled… at least TCP/IP needs to be anyway. :slight_smile:

You might try running “netstat -a” from the command line and verify that UDP 1434 is listening. Your first method of specifying the instance was correct, so either TCP/IP isn’t fully enabled, or something is blocking it.

Regards,

1 Like

Alex, take note that with the output from netstat -a the UDP port may be listed as ms-sql-m rather than 1434

All except “Named Pipes” were enabled. I enabled that one and re-started the SQL service but no change. The only protocol not enabled now is “VIA”.

The “netstat -a” produces a line “UDP [::]:1434 :” That is the only reference I see for UDP at that port #.

Is the SQL Server Browser service running?

Darren

Yes, the SQL Server Browser service is running.

I recently had this problem using SQL Server 2008 R2. Besides above: ensuring the firewall ports are open (both hardware and software firewalls), SQL Server Browser is running, SQL Server Instance allows Remote Connections, and SQL Server TCP/IP is enabled, I had to do the following to get the remote connection to work:

  • In the SQL Server TCP/IP Properties, explicitly set the TCP Port to 1433 and TCP Dynamic Ports to blank under IPAll section
  • In Ignition Database Connection Properties Connect URL, explicitly supply the port number. ie. “jdbc:sqlserver://<InstanceName>:1433”

Hope this helps.

2 Likes

I have a test machine with SQL 2008 R2. Instead of using localhost, put the computer name.

Example: jdbc:sqlserver://TRAINING3\SQLEXPRESS
TRAINING3 is the computer name
SQLEXPRESS instance name

1 Like

[quote=“chris”]I recently had this problem using SQL Server 2008 R2. Besides above: ensuring the firewall ports are open (both hardware and software firewalls), SQL Server Browser is running, SQL Server Instance allows Remote Connections, and SQL Server TCP/IP is enabled, I had to do the following to get the remote connection to work:

  • In the SQL Server TCP/IP Properties, explicitly set the TCP Port to 1433 and TCP Dynamic Ports to blank under IPAll section
  • In Ignition Database Connection Properties Connect URL, explicitly supply the port number. ie. “jdbc:sqlserver://<InstanceName>:1433”

Hope this helps.[/quote]

This solved my problems after getting a “port 49565 has failed” timeout. Deleted port 49565 from the TCP Dynamic Ports and added port 1433 to the TCP Port and got the “Valid” status. We were connecting to SQL Server Express 2014 that was installed on top of SQL Server Express 2008.

alex.ferrell, is this still something you need help with?

I also waste my time with this problem. I add not only the port 1434, 1433 but also SQL Server Browser Run in configuration manager.

FWIW, I came up against an error similar to this, and the issue was that the IP addresses within the TCP/IP properties were set to Disabled. I enabled the localhost one (and the others just in case) and it started working.

image

3 Likes

To connect to a remote server, I had to specify the default port 1433 at the end for it to work:

Solution, Thanks