Loading Data from Microsoft SQL Server

This section explains how to connect Microsoft SQL Server with Exasol and then load data.

To view details about data type mappings or to migrate data, see the SQL Server to Exasol migration script in our GitHub repository.

Additionally, you can also use the jTDS driver, which is an open source Java type 4 JDBC driver for Microsoft SQL Server, to connect to Exasol.

Download Driver

  • You can download the JDBC driver for SQL Server from the Microsoft JDBC download page. To know the JDBC driver compatible with your database version, refer to the JDBC driver support matrix and policy on the Microsoft documentation site.

    Only open source and Java 8 (.jre8) JDBC drivers are supported.

  • You can download the jTDS driver for SQL Server from the Sourceforge website.

Add JDBC Driver

To add a JDBC driver, you must create a configuration file called settings.cfg. Use the below settings to create the file, replacing the JAR entry with the name of the jar file you downloaded:

Microsoft JDBC Driver

DRIVERNAME=MSSQLServer
JAR=mssql-jdbc-11.2.0.jre8.jar
DRIVERMAIN=com.microsoft.sqlserver.jdbc.SQLServerDriver
PREFIX=jdbc:sqlserver:
NOSECURITY=NO
FETCHSIZE=100000
INSERTSIZE=-1

jTDS JDBC Driver

DRIVERNAME=jtdssqlserver
JAR=jtds-1.3.1.jar
DRIVERMAIN=net.sourceforge.jtds.jdbc.Driver
PREFIX=jdbc:jtds:sqlserver:
NOSECURITY=NO
FETCHSIZE=100000
INSERTSIZE=-1

Follow the procedure described in Add JDBC Drivers to upload the settings.cfg configuration file and the JDBC driver jar file(s).

For additional information, refer to the JTDS Driver section in this Exasol Knowledge Base article that describes best practices for using IMPORT/EXPORT with SQL Server.

Run Statement for MSSQL JDBC Driver

Run the following statement to create a connection.

CREATE OR REPLACE CONNECTION JDBC_SQLSERVER
    TO 'jdbc:sqlserver://192.168.99.100:1433;databaseName=master;instance=v1'
    USER 'user'
    IDENTIFIED BY 'Password';

Run the following statement to test the connection.

select * from 
(
import from JDBC at JDBC_SQLSERVER
statement 'select ''Connection works'' '
);

Run Statement for jTDS JDBC Driver

The jTDS connection string format used to connect to SQL Server is as follows: 

jdbc:jtds:sqlserver://{SERVER_NAME};databaseName={DATABASE_NAME);instance={INSTANCE}

Run the following statement to create a connection.

CREATE OR REPLACE CONNECTION JDBC_SQLSERVER
    TO 'jdbc:jtds:sqlserver://192.168.99.100:1433;databaseName=master;instance=v1'
    USER 'user'
    IDENTIFIED BY 'Password';

Run the following statement to test the connection.

select * from 
(
import from JDBC at JDBC_SQLSERVER
statement 'select ''Connection works'' '
);

Load Data

You can use the IMPORT statement to load data using the connection you created above. IMPORT supports loading data from a table or a SQL statement.