Generic JDBC connection
Use the Generic JDBC connection to connect to a data source that has no connection defined for Cloud Pak for Data.
If you want to connect to multiple instances of the data source in a consistent way, a Cloud Pak for Data administrator can create a Custom JDBC connector for the data source. The connection will be available on the New connection page with the name, details, and properties that are defined by the administrator who creates the connector.
- Supported JDBC versions
- Prerequisites
- Connection details
- Where you can use this connection
- Example JDBC URLs
Supported JDBC versions
The JDBC JAR file must be compatible with JDK 8, JDBC version 4.2 or earlier.
Prerequisites
-
Cloud Pak for Data common core services must be installed. The common core services are automatically installed by services that rely on them. If you don't see the Platform connections page, it's because none of the services that are installed in your environment rely on the common core services.
-
Upload the JDBC driver (JAR file) for the data source to Cloud Pak for Data. See Importing JDBC drivers for the procedure and required permissions to upload the JAR file to Cloud Pak for Data. Important: Starting in version 4.8.4, uploading JDBC drivers is disabled by default. Starting in 4.8.5, by default in new installations, users cannot view the list of JDBC drivers in the web client. An administrator must enable users to upload or view JDBC drivers.
Connection details
To create the Generic JDBC connection, you must have the following information about the data source.
Information | Status | Description |
---|---|---|
Required JAR files | Required | The JAR files required to connect to the data source. If a JDBC connection requires multiple JAR files, ensure that you know which JAR files are needed. |
JDBC driver class | Required (Except for DataStage) | The name of the JDBC driver class. This name is specified by the JDBC driver provider. For details, refer to the JDBC driver documentation. |
JDBC URL | Required | The JDBC URL used to connect to the database. Refer to the JDBC driver documentation for information about the syntax of the URL. |
SSL details | Conditional For DataStage properties, see Generic JDBC connector. |
If the port that you specified in the JDBC URL is configured to accept SSL connections, ensure that you select The port is configured to accept SSL connections. If your data source uses chained certificates, you can specify the contents of multiple certificates. If you paste the self-signed certificate into the SSL Certificate box, the certificate will be imported into a temporary truststore and secured with a password. You must reference the truststore and password in the JDBC connection URL by specifying the connection properties in the JDBC properties box. For example: ssl=true sslTrustStoreLocation=${truststore_file} sslTrustStorePassword=${truststore_password} |
Batch size | Optional | The maximum number of rows to send to the database. The default is 2000. |
Fetch size | Optional | The maximum number of rows to fetch from the database for each call. The default is 2000. |
Connector uses catalog structure | Optional | Some data sources use catalogs instead of schemas to structure data. Select if the data source uses a catalog structure. |
Case-sensitivity | Conditional | If the IDs in the database are case-sensitive, select Indicates whether ID values for this database are case sensitive. |
JDBC properties | Optional | The JDBC properties to use to connect to the database. Specify the properties with this format:key1=value1;key2=value2;key3=value3 Refer to the JDBC driver documentation for information about supported properties. |
Row limit support | Optional | Indicates whether the driver supports a row limit in a SELECT statement. You can specify None, Prefix, or Suffix. |
Row limit prefix | Conditional | If you set Row limit support to Prefix, specify the prefix that is used to indicate a row limit in a SELECT statement. Use $ {row_limit} to indicate where to put the row limit value. For example:TOP ${row_limit} |
Row limit suffix | Conditional | If you set Row limit support to Suffix, specify the suffix that is used to indicate a row limit in a SELECT statement. Use $ {row_limit} to indicate where to put the row limit value. For example:LIMIT ${row_limit} ROWS |
For Credentials and Certificates, you can use secrets if a vault is configured for the platform and the service supports vaults. For information, see Using secrets from vaults in connections.
Choose the method for creating a connection based on where you are in the platform
- In a project
- Click Assets > New asset > Data access tools > Connection. See Adding a connection to a project.
- In a catalog
- Click Add to catalog > Connection. See Adding a connection asset to a catalog.
- In a deployment space
- Click Add to space > Connection. See Adding connections to a deployment space.
- In the Platform assets catalog
- Click New connection. See Adding platform connections.
Next step: Add data assets from the connection (Optional)
Where you can use this connection
You can use Generic JDBC connections in the following workspaces and tools:
Projects
- AutoAI (Watson Machine Learning)
- Data quality rules (IBM Knowledge Catalog). See Supported data sources for data quality rules: Other data sources.
- Data Refinery (Watson Studio or IBM Knowledge Catalog)
- DataStage (DataStage service). See Generic JDBC connector.
- Metadata enrichment (IBM Knowledge Catalog). See Supported data sources for metadata enrichment: Other data sources.
- Metadata import (IBM Knowledge Catalog)
- Notebooks (Watson Studio). Click Read data on the Code snippets pane to get the connection credentials and load the data into a data structure. See Load data from data source connections.
- SPSS Modeler (SPSS Modeler service)
Catalogs
- Platform assets catalog
- Other catalogs (IBM Knowledge Catalog)
- Watson Query service
- You can connect to this data source from Watson Query. This connection requires special consideration in Watson Query. See Connecting to data sources with a generic JDBC driver in Watson Query.
Federal Information Processing Standards (FIPS) compliance
- 4.8.0 and 4.8.1: This connection can be compliant with FIPS if you installed Cloud Pak for Data on or prior to January, 22, 2024. The FIPS support for the Generic JDBC connection depends on the JAR file or files that you use for the connection. Not all JAR files work in a FIPS-enabled environment. Test the connection to confirm that it works.
- 4.8.2 and later: This connection is not compliant with FIPS, but it is FIPS-tolerant. Test the connection to confirm that it works.
Example JDBC URLs
- Databricks
- Driver: com.simba.spark.jdbc.Driver
jdbc:spark://<DatabricksHost>:443/default;transportMode=http;ssl=1;AuthMech=3; httpPath=<Databricks_compute_resources_URL>;connCatalog=<WKC_catalog>;UID=token; PWD=<password>?EnableArrow=
For more information, see Building the connection URL for the legacy Spark driver.
- Db2
- Driver: com.ibm.db2.jcc.DB2Driver
jdbc:db2://<Hostname>:<Port>/<DatabaseName>
- Microsoft SQL Server
- Driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
The Microsoft SQL Server driver works for Windows authentication. Download the latest Microsoft JDBC Driver for SQL Server.
Required properties for the Microsoft SQL Server driver:
server_address
authenticationScheme=NTLM
integratedSecurity=true
jdbc:sqlserver://<server_address>:<port><\your_instance>;database=<DatabaseName>; authenticationScheme=NTLM;integratedSecurity=true;domain=<your_domain>
- MongoDB
- Driver: com.ddtek.jdbc.mongodb.MongoDBDriver and Port is SSL-Enabled selected.
jdbc:datadirect:mongodb://<MongoDBHost>:<MongoDBPort>;DatabaseName=<DatabaseName>;SchemaMap=/tmp/mongodb.config;EncryptionMethod=SSL;ValidateServerCertificate=false;ReadOnly=false;
- MySQL
- Driver: com.mysql.cj.jdbc.Driver
jdbc:mysql://<MySQLHost>:<MySQLPort>/<DatabaseName>?useSSL=false
- Oracle
- Driver: oracle.jdbc.OracleDriver
jdbc:oracle:thin:<Username>/<Password>@<Hostname>:<Port>:<ORACLE_SID>
Parent topic: Supported connections