Bobcares

JDBC jTDS SQL Server Driver

by | May 30, 2022

In SQL Server, the jTDS JDBC driver is the fastest. The specifics are as described in the following.

As part of our SQL server support Service, Bobcares responds to all inquiries, large and small.

Let’s take a look at how our Support team explained how to use the jTDS JDBC driver in SQL Server.

jTDS JDBC Driver in SQL server

JDBC (Java Database Connectivity) is a programming interface for accessing a relational database from Java applications. SuperCHANNEL requires a JDBC driver in order to connect to the relational database system (SQL Server, Oracle, etc.) where our source data is stored. Before we can use SuperCHANNEL, we must first install the appropriate JDBC driver and then configure SuperCHANNEL to use it. The JDBC drivers are usually provided by the database vendors. The drivers are not provided by STR.

Step 1: Get the driver and install it.

  1. Firstly, get the most recent version of the jTDS driver from here: https://sourceforge.net/projects/jtds/files/
  2. Then, from the downloaded file, extract the driver file. The driver file will be named jtds-1.3.0.jar and will be a.jar file.
  3. The driver file can be accessed by SuperCHANNEL from anywhere on our system, but it is recommended that we copy it to the SuperCHANNEL installation’s drivers directory.
  4. If we use the default installation options, the following is the location: C:\Program Files\STR\SuperCHANNEL\jar\drivers
  5. We may require administrator permissions to copy to this directory, depending on our system configuration. Finally, click Continue. If an administrator permissions prompt appears.

Step 2: Modify the SuperCHANNEL Configurations

  1. config.txt is the SuperCHANNEL configuration file. This file will be located in if we chose the default installation options: C:\ ProgramData\STR\SuperCHANNEL\bin
  2. Firstly, before making any changes, create a backup copy of this file.
  3. Then, in a text editor, open config.txt.
  4. Find the line that defines the Java class path property (java.class.path=) and append the following to the end:

    $(SNU_PROGRAM_HOME)jardriversjtds-1.3.0.jar;. Then, replace jtds-1.3.0.jar with the name of the driver we installed.

  5. A semi colon must be used to separate each entry in the Java class path definition. $(SNU_PROGRAM_HOME) is a predefined variable that refers to the directory containing the SuperCHANNEL programme files. If we did not save the driver in the SuperCHANNEL drivers directory, we must specify the full path to the driver location instead.
  6. Then, find the line that defines the jdbc.drivers property and append the following to the end: net.sourceforge.jtds.jdbc.Driver . A colon must be used to separate each entry in the jdbc.drivers definition.
  7. Finally, save config.txt.

Step 3 – SQL Server Express

When we try to connect to the database in SuperCHANNEL using SQL Server Express, we may get a connection error (“connection refused”). This is because SQL Server Express is set up to use dynamic TCP/IP ports by default. Before we begin using SuperCHANNEL, make the following preparations:

  1. Firstly, go to SQL Server Configuration Manager and open it.
  2. Then, select SQL Server Network Configuration.
  3. Select Protocols for SQLEXPRESS or Protocols for MSSQLSERVER (depending on our SQL Server version).
  4. Then, select the IP Addresses tab in TCP/IP Properties.
  5. Check whether TCP Dynamic Ports has a value at the bottom. If so, remove the value and leave the field blank.
  6. Finally, modify the TCP Port to 1433 or our preferred port.

Step 4 : Begin SuperCHANNEL

To connect to SQL Server, launch SuperCHANNEL, select File > Connect to Source, and enter the following connection string:

jdbc:jtds:sqlserver://:/;useCursors=true

Where:

  • The name of our SQL Server host is specified by servername.
  • The port used to communicate with SQL Server is specified by port (the default is 1433).
  • Name of the source database to connect to is specified by databasename.

For the connection to succeed, we will also need to provide user credentials (for SQL Server authentication) and a schema name.

Step 5 : Update the SNU Class Path

It’s possible that we’ll need to add our driver to the SNU class path as well. This step is only necessary if the following conditions are met:

  • The driver JAR file was saved in a location other than the SuperCHANNEL drivers directory.
  • We plan to use SNU, the SuperCHANNEL Command Line Utility, to run SuperCHANNEL from the command line or via scripting.

In snu.bat, the SNU class path is defined. This file is located in C:\ProgramData\STR\SuperCHANNEL\bin by default. Before making any changes, make a backup copy of the file.

jTDS JDBC Driver URL Formats

Using SQL Server authentication, here’s an example JDBC URL with host, port, and database name:

jdbc:jtds:sqlserver://192.168.1.172:53000/sample

To improve performance, use the following JDBC URL with server-side cursors enabled:

jdbc:jtds:sqlserver://192.168.1.172:53000/sample;useCursors=true

Why use jTDS?

jTDS is open-source software. jTDS is licenced under the GNU LGPL, which allows us to not only debug and tweak it to our hearts’ content, but also to use and distribute it in our free and commercial applications. The JDBC-ODBC bridge and Microsoft’s own JDBC driver, which are advertised as “free,” are not actually free. We won’t be able to fix any of them ourselves if something goes wrong, and Microsoft and Oracle’s response times aren’t exactly quick.

For both SQL Server and Sybase, jTDS is the most performant JDBC driver. We have an older benchmark result, but we strongly advise you to download any benchmark published by commercial JDBC driver vendors and check it out for yourself. Here are a few examples of possible benchmarks: BenchTest 2.1 for MS SQL Server by i-net Software and JNetDirect’s JDBC Performance Benchmark. In any case, give it a try. Get the most recent version from here and see if we like it.

[Looking for a solution to another query? We are just a click away.]

Conclusion

To sum up, our Support team demonstrated how to use SQL Server with the jTDS JDBC driver.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

2 Comments

  1. Joseph

    JTDS 1.3.1 for Android Studio working with SQL server 2014, but not working with SQL server 2019

    Reply
    • Hiba Razak

      Hi,
      Please contact our support team via live chat(click on the icon at right-bottom).

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.