Generic JDBC Connector
This feature is only available after version 2.4.3
Generic JDBC Connector is a universal Java database connector that can be used to connect and access various types of relational databases, such as MySQL, PostgreSQL, Oracle, etc. in Java applications. It allows applications to connect to databases via the Java Database Connectivity (JDBC) API and execute SQL queries and commands.
Requirements
Before using Generic JDBC Connector, you need:
- A JDBC driver for the database or system you want to connect.
Using PostgreSQL as an example for connecting. PostgreSQL JDBC Driver Download Link
Step 1: Create a JDBC Driver
Click on the Settings
icon and select the Drives
option.
After entering the Drivers
page, click the Create a JDBC Driver
button.
Fill in the following configuration information.
Name
: The display name of the Driver.Class Name
: The name of the Driver class. E.g. for Postgres this would be org.postgresql.Driver.Upload JAR File
: The jar file of the Driver.Limit Pushdown
: Enables a connector to push processing of such queries of unsorted record to the underlying data source.Limit Pushdown Clause
: (if enabled limit pushdown) select the limit Pushdown clause.Ignore System Schema Pattern
: To avoid exploring tables timeout, it can fill out regular expression to ignore system schemas.
After submitting, the created driver will be displayed in the table.
Step 2: Create a Generic JDBC Data Source
You can create a data source through the following two operations. The first is to click the "+" button on the sidebar Data Source or click the Create a Data Source button on the Overview page to create.
Step 3: Set connection information
Name
: Database name, for display, can be modified later.Data Source Type
: Database type, please selectGeneric JDBC
.Driver
: Select the driver you want to connect.URI
: Please fill injdbc:<protocal>://<host>:<port>/databaseName
format, for examplejdbc:postgresql://10.10.0.9:3432/tpchsf1
.Username
: Username used for connection.Password
: Password used for connection.Unsupported Type Handling
: Configure how unsupported column data types are handled.Table Pattern
: Can use Java regular expression to filter the tables you want to connect. E.g.public.r.*
for selecting all tables under thepublic
schema whose names start with the letterr
.Default Scale
andNumber Rounding Mode
: If the Table contains floating point types, such asDouble
,Float
, and the data also has decimal point values, you need to set these two fields.Explore Timeout
: If the database contains a large number of Tables, it is recommended to increase this parameter so that the Explorer can wait for a longer time.
Step 4: Complete the build
After submitting, the Generic JDBC data source will show up in the sidebar in a few moments, and you can click to enter the data source details page.