Error connecting to SQL Server Express 2008 R2

#1

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.

0 Likes

#2

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.

0 Likes

#3

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.

0 Likes

#4

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

0 Likes

#5

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

0 Likes

#6

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

0 Likes

#7

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

0 Likes

#8

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,

0 Likes

#9

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

0 Likes

#10

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 #.

0 Likes

#11

Is the SQL Server Browser service running?

Darren

0 Likes

#12

Yes, the SQL Server Browser service is running.

0 Likes

#13

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.

1 Like

#14

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

0 Likes

#15

[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.

0 Likes

#16

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

0 Likes

#17

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.

0 Likes