Search code examples
sql-server-2000shared-memorywindows-server-2012tcpjtds

Connecting to SQL Server using shared memory and jtds driver


I have a java application which connects to SQL Server 2000 using jtds driver. It is working fine on Windows Server 2003. The connection string I used here is as below

con = java.sql.DriverManager.getConnection( "jdbc:jtds:sqlserver://127.0.0.1:1433/DBName", info );

Now I am trying to run the same application on Windows server 2012. But the problem here is, SQL server 2000 is not listening to TCP Port 1433, but it is listening to shared memory. Hence it fails the connection.

I tried to enable TCP/IP Protocol as mentioned in workaround section in this link Enabling TCP/IP Through the Server Network Utility. SQL server didn't start listening to TCP/IP even after restarting the server.

To solve this problem, either I have to make SQL server listen to TCP/IP port or I need to change my code to connect using shared memory if Server is not listening to TCP/IP port.

I am trying to connect to server using shared memory with below connection string as mentioned in this page Creating a Valid Connection String Using Shared Memory Protocol

con = java.sql.DriverManager.getConnection( "jdbc:jtds:sqlserver://localhost\SQLEXPRESS:1433/DBName", info );

Which leads to the exception java.sql.SQLException: Unknown server host name 'localhost\SQLEXPRESS'.

I also tried the connection string:

con = java.sql.DriverManager.getConnection( "jdbc:jtds:sqlserver://localhost\SQLEXPRESS/DBName", info );

which produces the exception: java.sql.SQLException: Unknown server host name 'localhost\SQLEXPRESS'.

It would be great if I can get solution for either of the problems

  1. Enabling TCP/IP port on Windows server 2012 for SQL server 2000
  2. Connecting to SQL server 2000 using shared memory protocol in jtds driver.

Thanks in advance, Jayanth


Solution

  • I got the solution for one of those 2 problems - Enabling TCP/IP port on Windows server 2012 for SQL server 2000.

    1. Launch SVRNETCN.exe in the path “C:\Program Files (x86)\Microsoft SQL Server\80\Tools\Binn”
    2. Select TCP/IP from Disabled protocols list and click on Enable
    3. Make sure the default port is set to 1433 for TCP/IP protocol by clicking on properties button