SQL Server JDBC Catalog
Run catalog SQL with a warehouse SQL user that can manage catalogs and access the source. Ensure network access from the warehouse to metadata, storage, and source endpoints. For connector deployment, host files, JVM settings, or service configuration changes, contact VeloDB Cloud support.
JDBC Catalog supports connecting to SQL Server databases through the standard JDBC interface. This document describes how to configure the SQL Server database connection.
For an overview of JDBC Catalog, please refer to: JDBC Catalog Overview
Usage notes
To connect to a SQL Server database, you need
-
SQL Server 2012 or later, or Azure SQL Database.
-
JDBC driver for SQL Server database, which you can download the latest or specified version from Maven Repository. It is recommended to use SQL Server JDBC Driver 11.2.x and above.
-
Network access from the warehouse to the source server, whose default port is 1433.
Connect to SQL Server
CREATE CATALOG sqlserver_catalog PROPERTIES (
'type' = 'jdbc',
'user' = 'username',
'password' = 'pwddd',
'jdbc_url' = 'jdbc:sqlserver://<host>:<port>;databaseName=<databaseName>;encrypt=true;trustServerCertificate=false',
'driver_url' = 'mssql-jdbc-11.2.3.jre8.jar',
'driver_class' = 'com.microsoft.sqlserver.jdbc.SQLServerDriver'
)
jdbc_url defines the connection information and parameters to be passed to the SQL Server JDBC driver. The parameters supported by the URL are provided in the SQL Server JDBC Driver Documentation.
Connection security
The JDBC driver and connector automatically use Transport Layer Security (TLS) encryption and certificate verification. This requires configuring appropriate TLS certificates on the SQL Server database host.
Keep encryption and certificate verification enabled in the connection string. Configure a trusted source certificate whose hostname matches the endpoint:
'jdbc_url' = 'jdbc:sqlserver://<host>:<port>;databaseName=<databaseName>;encrypt=true;trustServerCertificate=false'
The TLS section of the SQL Server JDBC Driver Documentation details other parameters such as trustServerCertificate, hostNameInCertificate, trustStore, and trustStorePassword.
Hierarchical mapping
When mapping SQLServer, a Database in VeloDB Cloud corresponds to a Schema under the specified Database in SQL Server (<databaseName> parameter in jdbc_url). A Table under a Database in VeloDB Cloud corresponds to Tables under a Schema in SQLServer. The mapping relationship is as follows:
| VeloDB Cloud | SQL Server |
|---|---|
| Catalog | Database |
| Database | Schema |
| Table | Table |
Column type mapping
| SQL Server Type | VeloDB Cloud Type | Comment |
|---|---|---|
| bit | boolean | |
| tinyint | smallint | SQLServer's tinyint is unsigned, so it is mapped to VeloDB Cloud's smallint |
| smallint | smallint | |
| int | int | |
| bigint | bigint | |
| real | float | |
| float | double | |
| money | decimal(19,4) | |
| smallmoney | decimal(10,4) | |
| decimal(P, S)/numeric(P, S) | decimal(P, S) | |
| date | date | |
| datetime/datetime2/smalldatetime | datetime(S) | |
| char/varchar/text/nchar/nvarchar/ntext | string | |
| time | string | |
| datetimeoffset | STRING | Maps to STRING in Core 26.1.3. Instant-preserving mapping is planned for a future release. |
| timestamp | string | Displays hexadecimal representation of binary data, no actual meaning |
| image/binary/varbinary | STRING / VARBINARY | STRING by default; VARBINARY when enable.mapping.varbinary = true. A future release makes the binary mapping unconditional. |
| other | UNSUPPORTED |
Common issues
-
Certificate authentication exception when connecting to SQL Server
SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption.Error: "sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException:unable to find valid certification path to requested target". ClientConnectionId:a92f3817-e8e6-4311-bc21-7c66Keep TLS enabled. Check that the SQL Server certificate chain includes the required intermediate certificates and that its hostname matches the server name in
jdbc_url. Use a compatible JDBC driver withencrypt=trueandtrustServerCertificate=false. Contact VeloDB Cloud support if the issuing CA needs to be added to the managed runtime's trust store. -
TLS exception when connecting to SQL Server
The server selected protocol version TLS10 is not accepted by client preferences [TLS13, TLS12]This is because the TLS protocol version between SQL Server and the JDBC client does not match. The connected SQL Server only supports TLS 1.0, while the JAVA environment where the JDBC client is located has TLS 1.0 disabled by default.
Enable TLS 1.2 on the source SQL Server. See SQL Server TLS 1.2 Support.
If the connection still fails, contact VeloDB Cloud support with the error, source SQL Server version, and JDBC driver version. Warehouse JVM security settings are managed by VeloDB Cloud.