
Also TCP/IP is enabled for this SQL Server instance.While I returned to eclipse to test a simple jdbc related program after couple of months, I encountered some kind of error. There is only one SQL Server instance (JOE-62CB72961D9\SQL2000) running on this machine. Please note the changes made in the code and the error messages shown above. I forgot to mention in the previous question that the ODBC connection was coming through TCP/IP protocol. Handle any errors that may have occurred.
You can test the Network connection using the PING grogram: ping(rs.getString(1) + " " + rs.getString(2)) Make sure the Network is workable and stable when you connect to SQL Server on a remote machine. Iterate through the data in the result set and display it.

String SQL = "SELECT TOP 10 * FROM Customers" Create and execute an SQL statement that returns some data. You can use the one that the instance was using dynamically, since you know it isnt in use by anything else. "databaseName=Northwind user=sa password=sa" Ĭlass.forName(".SQLServerDriver") Ĭon = DriverManager.getConnection(connectionUrl) So, you may want to set your named instance to run on a specific port number, instead of using a dynamic port (the default), and then hard-coding that port number in the JDBC connection string. An instance is identified by an instance name. Recheck that you have spelled the connection string in the code correctly or not. If you can connect to the SQL Server, the problem should be on the coding. Create a variable for the connection string. Connecting to Named Instances Microsoft SQL Server and Microsoft SQL Server 2005 support multiple instances of a SQL Server database running concurrently on the same server. You should test if you can connect to the SQL Server first by using SQL Server Management Studio with the same parameters as in your code. The version is SQL Server is Sql Server 2000 Developer Edition running on Windows XP Professional Version 2002 Service Pack 2.


But when I try to create and test a System DSN using the ODBC Data Source administrator the connection is established successfully for the above given server. verify that the SQL Server Browser Service is running on the host. Verify the server and instance names, check that no firewall is blocking UDP traffic to port 1434, and for SQL Server 2005 or later. The following is the error message: .SQLServerException: The connection to the host JOE-62CB72961D9, named instance sql2000 has failed. On executing the java code which establishes connection to the server JOE-62CB72961D9\SQL2000 using the Microsoft SQL Server JDBC Driver which is a Java Database Connectivity (JDBC) 4.0 compliant driver.
