JDBC Driver for SQL Server

Build 20.0.7587

Establishing a Connection

Creating a JDBC Data Source

You can create a JDBC data source to connect from your Java application. Creating a JDBC data source based on the CData JDBC Driver for SQL Server consists of three basic steps:

  • Add the driver JAR file to the classpath. The JAR file is located in the lib subfolder of the installation directory. Note that the .lic file must be located in the same folder as the JAR file.
  • Provide the driver class. For example:
    cdata.jdbc.sql.SQLDriver
  • Provide the JDBC URL. For example:
    jdbc:sql:user=myuser;password=mypassword;Server=localhost;Database=Northwind;
    
    or
    
    jdbc:cdata:sql:user=myuser;password=mypassword;Server=localhost;Database=Northwind;

    The second format above can be used whenever there is a conflict in your application between drivers using the same URL format to ensure you are using the CData driver. The URL must start with either "jdbc:sql:" or "jdbc:cdata:sql:" and can include any of the connection properties in name-value pairs separated with semicolons.

You can use the CData JDBC Driver for SQL Server to connect to any instance of Microsoft SQL Server, Azure SQL Server, or Azure Data Warehouse.

Authenticating to Microsoft SQL Server

You can authenticate to SQL Server using either standard or Kerberos authentication.

Authenticate using Standard Authentication

To authenticate to Microsoft SQL Server using standard authentication, set the following:

  • User: The username provided for authentication with SQL Server.
  • Password: The password associated with the authenticating user.

Authenticate using Kerberos Authentication

To authenticate to Microsoft SQL Server using Kerberos authentication, set the following:

  • AuthScheme: Set this to kerberos to enable Kerberos authentication.
  • KerberosKDC: The Kerberos Key Distribution Center (KDC) service used to authenticate the user.
  • KerberosRealm: The Kerberos Realm used to authenticate the user with.
  • KerberosSPN: The Service Principal Name for the Kerberos Domain Controller.
  • User: The username provided for authentication with SQL Server.
  • Password: The password associated with the authenticating user.

Connecting to Microsoft SQL Server

Once you've configured all requirede authentication properties, connect to Microsoft SQL Server using the following:

  • Server: The name of the server running SQL Server.
  • Database: The name of the SQL Server database.

Connecting to Azure SQL Server and Azure Data Warehouse

You can authenticate to Azure SQL Server or Azure Data Warehouse by setting the following connection properties:

  • Server: The server running Azure. You can find this by logging into the Azure portal and navigating to SQL databases (or SQL data warehouses) -> Select your database -> Overview -> Server name.
  • User: The name of the user authenticating to Azure.
  • Password: The password associated with the authenticating user.
  • Database: The name of the database, as seen in the Azure portal on the SQL databases (or SQL warehouses) page.

Copyright (c) 2020 CData Software, Inc. - All rights reserved.
Build 20.0.7587