Load data from Microsoft SQL Server
This section explains how to connect to 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.
Prerequisites
-
The SQL Server system must be reachable from the Exasol system.
-
The user credentials in the connection must be valid.
Download driver
-
Download the JDBC driver for SQL Server from Microsoft JDBC download . To know which JDBC driver is compatible with your database version, refer to the JDBC driver support matrix and policy .
-
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. You can download the jTDS driver for SQL Server from the Sourceforge website.
Configure JDBC driver in EXAoperation
Follow these steps to configure the JDBC driver for SQL Server in EXAoperation:
- Log in to EXAoperation user interface as an Administrator user.
- Select Configuration > Software and click the JDBC Drivers tab.
- Click Add to add the JDBC driver details.
- Enter the following details for the JDBC properties:
- Driver Name:
MSSQL
- Main Class:
com.microsoft.sqlserver.jdbc.SQLServerDriver
- Prefix:
jdbc:sqlserver:
- Disable Security Manager: Leave this option unchecked.
- Comment: This is an optional field.
- Driver Name:
- Click Add to save the settings.
- Click Choose File to locate the downloaded driver and click Upload to upload the JDBC driver.
Configure jTDS JDBC driver in EXAoperation
Follow these step to configure the jTDS JDBC driver in EXAoperation:
- Log in to EXAoperation user interface as an Administrator user.
- Select Configuration > Software and click the JDBC Drivers tab.
- Click Add to add the JDBC driver details.
- Enter the following details for the JDBC properties:
- Driver Name:
JTDSMSSQL
- Main Class:
net.sourceforge.jtds.jdbc.Driver
- Prefix:
jdbc:jtds:sqlserver:
- Disable Security Manager: Leave this option unchecked.
- Comment: This is an optional field.
- Driver Name:
- Click Add to save the settings.
- From list of JDBC drivers, select the radio button next to the desired driver.
- Click Choose File to locate the downloaded driver and click Upload to upload the JDBC driver.
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.
Connect using MSSQL JDBC driver
To create a connection, run the following statement. Replace the connection string and credentials as needed.
CREATE OR REPLACE CONNECTION JDBC_SQLSERVER
TO 'jdbc:sqlserver://192.168.99.100:1433;databaseName=MY_DATABASE;instance=v1'
USER 'user'
IDENTIFIED BY 'password';
To test the connection, run the following statement.
Connect using jTDS JDBC driver
The jTDS connection string format used to connect to SQL Server is as follows:
jdbc:jtds:sqlserver://{SERVER_NAME}/{DATABASE_NAME);instance={INSTANCE}
To create a connection, run the following statement. Replace the connection string and credentials as needed.
CREATE OR REPLACE CONNECTION JDBC_SQLSERVER
TO 'jdbc:jtds:sqlserver://192.168.99.100:1433/MY_DATABASE;instance=v1'
USER 'username'
IDENTIFIED BY 'password';
To test the connection, run the following statement:
Windows authentication
You can use Windows authentication in conjunction with the jTDS driver by adding the parameters useNTLMv2=true
and domain=[domain name]
. For example:
CREATE OR REPLACE CONNECTION JDBC_SQLSERVER
TO 'jdbc:jtds:sqlserver://192.168.99.100:1433/MY_DATABASE;domain=AD;useNTLMv2=true;'
USER 'username' -- Windows username
IDENTIFIED BY 'password' --Windows password;
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.
See also
For additional information, see Best Practices for IMPORT/EXPORT with SQL Server.