Connecting to Microsoft SQL Server using jTDS

  • Post author:
  • Post category:MySQL

Here’s how we are able to connect to Microsoft SQL Server using the jTDS JDBC driver. This is a local development environment using a newly installed SQL Server Express 2012.

1. Create the user with SQL Server authentication. Here we are using SQL Server Management Studio to create the new user “demo”.

Microsoft SQL server Login
Figure 1
Connecting to Microsoft SQL Server using jTDS - Fig 2
Figure 2

2. Make sure SQL Server supports both Windows and SQL Server authentication. Here we are using SQL Server Management Studio.

Connecting to Microsoft SQL Server using jTDS - Figure 3
Figure 3
Connecting to Microsoft SQL Server using jTDS - Figure 4
Figure 4

3. Enable TCP/IP for the database instance. Here we are going to use the SQL Server Configuration Manager.

Connecting to Microsoft SQL Server using jTDS - Figure 5
Figure 5
Connecting to Microsoft SQL Server using jTDS - Figure 6
Figure 6

4. Start the SQL Browser service. Go to Control Panel -> Administrative Tools -> Services and start the SQL Server Browser.

Connecting to Microsoft SQL Server using jTDS - Figure 7

5. Here are the JDBC parameters passed to jTDS.

url=jdbc:jtds:sqlserver://localhost:1433/MY_DATABASE;instance=MY_INSTANCE
driver=net.sourceforge.jtds.jdbc.Driver
user=MY_USERNAME
password=MY_PASSWORD

Please replace the MY_ variables with your own values.

This Post Has One Comment

  1. usman

    how to find server ip address in sql server 2014

Comments are closed.