This section refers to the necessary steps or conditions you must fulfill before setting up a JDBC (Java Database Connectivity) connection. These are the required tools, configurations, or settings to ensure that the JDBC connection works smoothly. The key prerequisites for JDBC include:
-
Verify the agent to which you want to upload the driver is healthy and all services are running.
-
Locate the custom-jdbc-connector which should be up and running.
-
To establish JDBC connectivity, the custom driver bundle must be a
.zip/.tar/.gzipfile containing the following:-
The JDBC driver JAR files.
- A driver.properties configuration file. When
setting up your configuration, you can now choose between two formats
that are the legacy single-file format and the new modular
structure.
Legacy single-file format: In this format, the file must specify the driver display name and driver class name for your JDBC driver. Below are the driver properties utilized for configuration, of which certain properties are mandatory.
- driver.display.name=My Awesome Driver
- driver.class.name=com.example.jdbc.Driver
- driver.assetpath.database.exists=true
- driver.sample.query=<query>
- driver.assetpath.schema.exists
New modular structure: In this format, you must manually create these folders and place the corresponding files in them. Here’s how you can structure it:
- bundle/driver.properties folder -
Includes core driver settings:
- driver.display.name
- driver.class.name
- driver.database.property
- driver.url.custom.params
- driver.assetpath.database.exists
- driver.assetpath.schema.exists
- driver.typemappings.filename
- driver.auto.append.querytimeout.enable
- driver.skip.auto.append.querytimeout.connection.types
- query/driver.properties folder –
Handles query-related logic and metadata:
- driver.sample.query
- file:/C:/DITAToo/Workspace/DISuite/Untitled2.dita
- driver.freshness.query
- driver.partitioning.query.cardinality
- driver.partitioning.query.distinct
- driver.partitioning.query.minmax
- driver.partitioning.query.count
- driver.partitioning.hash.function
- driver.partitioning.concat.pattern
- driver.partitioning.rownumber.expression
- driver.partitioning.cast.nonstring.pattern
- dialect/driver.properties folder –
Manages SQL dialect and replication-friendly query
generation:
- driver.dialect.classname
- driver.dialect.delegate.classname
- driver.dialect.delegate.urls
Important: This modular setup improves clarity and maintainability, while the legacy single-file structure is retained for backward compatibility.- bundle/driver.properties folder -
Includes core driver settings:
-
Driver Properties
| Driver Property | Description | Examples |
|---|---|---|
| driver.display.name | Specifies the name of the driver that displays in the UI. This is a mandatory property. | driver.display.name=My Awesome Driver |
| driver.class.name | Specifies the fully qualified driver class name. This is a mandatory property. | driver.class.name=com.example.jdbc.Driver |
| driver.assetpath.database.exists | Defines whether the database must be part of the cataloging
or not. Default value: If value is set to true, then the database will be a part of the cataloging. And if value is set to false then the database will not be part of cataloging. |
driver.assetpath.database.exists=true |
| driver.sample.query | It is recommended to use this property with the value as a
placeholder SELECT query, formatted as shown in the examples.
This sample query serves as a template, outlining the query
structure using the allowed placeholders. The application will
then replace the placeholders with actual values to generate the
final query for execution. Allowed placeholders, %fields%: Specifies a placeholder for columns to be selected. %limit%: Specifies a placeholder for the number of records to query. Ensure to add the keyword and syntax to limit the number of rows as per the database that you are using (e.g., TOP, LIMIT, FETCH FIRST, ROWNUM, etc.). %database%: Specifies a placeholder for the database name used in the query. Add any necessary special characters (e.g., double-quotes, square brackets) around this placeholder as required by your database. %schema%: Specifies a placeholder for the schema name used in the query. Add any necessary special characters (e.g., double-quotes, square brackets) around this placeholder as required by your database. %table%: Specifies a
placeholder for the table or dataset to be queried. Add any
necessary special characters (e.g., double-quotes, square
brackets) around this placeholder as required by your
database.
Note: Ensure that the delimiter used to
separate the database, schema, and table placeholders
are specific to the database that you are
using.
|
For MSSQL and Azure Synapse Analytics: Select TOP %limit% %fields% From
[%database%].[%schema%].[%table%]For Oracle:
For PostgreSQL, refer to this documentation. For IBM DB2, refer to this documentation. For AWS Redshift, refer to this documentation. |
|
driver.sample.fields.enclosure.opening driver.sample.fields.enclosure.closing |
The property,
driver.sample.fields.enclosure.opening
: Specifies the character that should appear at the start of
each field or column in the query, as per the requirement of the
database. The property, driver.sample.fields.enclosure.closing : Specifies the character that should appear at the end of each field or column in the query, as per the requirement of the database. Note:
|
If your query appears as: SELECT name, age, address
FROM db.schema.users; The below properties are set by you driver.sample.fields.enclosure.opening = [ driver.sample.fields.enclosure.closing = ] Then the same query would be transformed into: SELECT [name], [age], [address] FROM db.schema.users; When defining the property for a datasource, for example, For PostgreSql: driver.sample.fields.enclosure.opening = " driver.sample.fields.enclosure.closing = " Then the query would be transformed into: SELECT "name", "age", "address" FROM db.schema.users; For MySQL: driver.sample.fields.enclosure.opening = driver.sample.fields.enclosure.closing = ' Then the query would be transformed into: SELECT 'name', 'age', 'address' FROM db.schema.users; |
|
driver.view.enable |
This boolean property enables users to specify whether or not they want to catalog views. By setting this property to true, the system will catalog the views. If set to false, cataloging of views will be skipped. |
|
| driver.assetpath.schema.exists |
Determines whether the schema should be included in the cataloging process. By default, the value is set to true, the schema will be included in the catalog. If the value is set to false, the schema will be excluded from the catalog. |
driver.assetpath.schema.exists=true |
| driver.spark.overrides.filename | Define the Spark data type property. This will be replaced with the matching SQL data type when you update the code. |
driver.spark.overrides.filename=spark_overrides.json
This
file should be placed in the same directory as the
driver.properties bundle. You can
utilize the default values provided in the files or modify
them according to your
requirements.
|
| driver.url.custom.params | The property is used to define the custom parameters that you want to append to the JDBC URL. | For Azure Synapse Analytics: connectionType=Synapse; |
driver.dialect.classname=com.precisely.runtime.spark.operators.jdbc.dialect.SynapseSQLServerDialect
driver.dialect.delegate.classname=org.apache.spark.sql.jdbc.MsSqlServerDialect
To upload custom JDBC driver to an agent:
- Access the VM where the agent is installed and upload the JDBC driver to an
agent using the command:
./discli drivers upload --name <driverDisplayName> --driverPath <driverPath>The
<driverDisplayName>must match thedriver.display.namepresent in thedriver.propertiesfile. - The driver will be uploaded successfully if the corresponding message appears in
the terminal. The uploaded driver files are stored in the directory:
/precisely/drivers/ - To verify the uploaded drivers, use the command :
./discli drivers list
| Commands | Description | Examples |
|---|---|---|
upload <file>
|
Uploads a driver zip file to the container's volume. Mandatory parameters:
Optional parameters:
--help or -h: Help for drivers
upload. |
./discli drivers upload
--name driverDisplayName --driverPath driverpath.zip
|
list
|
Lists all available drivers/packages in the container's volume. |
/discli drivers
list |
delete <driver>
|
Deletes the driver with the specified ID from the container's volume. |
./discli drivers delete
driver_id |