wood burning stoves*
The moose likes JDBC and the fly likes Test failed: The connection to the host localhost, named instance moeincom has failed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Test failed: The connection to the host localhost, named instance moeincom has failed" Watch "Test failed: The connection to the host localhost, named instance moeincom has failed" New topic
Author

Test failed: The connection to the host localhost, named instance moeincom has failed

ali honarmand
Ranch Hand

Joined: Oct 12, 2009
Posts: 32

Hi everyone,
I'm trying to connect to a "mssqlserver" instance but face the following error:

Test failed: The connection to the host localhost, named instance moeincom has failed. Error: "java.net.SocketTimeoutException: Peek 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 use Sqljdbc4.jar jdbc driver. and I use JDeveloper Studio
Parameters are:
HostName: localhost
InstanceName: moeincom; which is my sqlserver instance name
databasename: XMLTestDB; which is my SqlServer DB name.
and I left "Port Number" blank.
Driver Class is "com.microsoft.sqlserver.jdbc.SQLServerDriver"
and at last Library is: Sqljdbc4.jar

thanks priorly,
A. Honarmand


A. Honarmand
Martyn Clark
Ranch Hand

Joined: Apr 16, 2005
Posts: 108
Hi ali,

It maybe that your named instance is listening on dynamic ports and not the default, you can check this by using configuration manager and checking the properties in TCP/IP this will show you what port the instance is listening on.


Martyn...<br /> <br />SCJP 1.4 SCWCD 1.4
ali honarmand
Ranch Hand

Joined: Oct 12, 2009
Posts: 32

Martyn Clark wrote:Hi ali,

It maybe that your named instance is listening on dynamic ports and not the default, you can check this by using configuration manager and checking the properties in TCP/IP this will show you what port the instance is listening on.


but how can I run configuration manager? I can find it(I use win 7), but I can not start it.
Martyn Clark
Ranch Hand

Joined: Apr 16, 2005
Posts: 108
sorry for the late reply ali but you should be able to find it here Start->Program Files-> Microsoft sql server 2005->Configuration Tools->sql server configuration manager. In configuration manager console, on the left hand panel, expand the sql server 2005 Network Configuration.
Click on the Protocols for Named-Instance-Name. On the right hand panel we need to right click and go to properties on the TCP/IP. The click on the ipAddresses tab any you can set/change port numbers.

Hope that helps.
ali honarmand
Ranch Hand

Joined: Oct 12, 2009
Posts: 32

Martyn Clark wrote:sorry for the late reply ali but you should be able to find it here Start->Program Files-> Microsoft sql server 2005->Configuration Tools->sql server configuration manager. In configuration manager console, on the left hand panel, expand the sql server 2005 Network Configuration.
Click on the Protocols for Named-Instance-Name. On the right hand panel we need to right click and go to properties on the TCP/IP. The click on the ipAddresses tab any you can set/change port numbers.

Hope that helps.


Thanks Martyn. For instance I have changed into MySql. It solved the problem. But I will use MSSQL in a short time.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Test failed: The connection to the host localhost, named instance moeincom has failed
 
Similar Threads
Exception during connecting to sql server2005
TCPView AND NO ERROR BUT!!!
[Microsoft][SQLServer 2000 Driver for JDBC]Error establishing
SQL Server - netbeans Connection problem
Wanted: Help using DBUnit with MS SQL Server: java.sql.SQLException: Invalid Fetch Size