How to Get and Configure the Flink JDBC Driver for DBeaver
Where to Get the Flink JDBC Driver
Since Flink does not provide an official pre-built JDBC driver, you need to obtain the Flink SQL Gateway JDBC Driver manually. Here are different ways to get it:
Option 1: Download from Maven Repository (Recommended)
You can download the Flink SQL Gateway JDBC driver from the official Apache Flink Maven repository.
Steps to Download from Maven
- Visit the Apache Flink Maven Repository
- Search for flink-sql-gateway-driver
- Download the latest
jar
file (e.g.,flink-sql-gateway-driver-1.17.0.jar
) - Place the downloaded
.jar
file in a location where DBeaver can access it.
Option 2: Extract from a Flink Distribution (If Available)
If you already installed Flink manually, you can check if the driver is included.
Steps to Locate the Driver in Your Flink Installation
- If you have a Flink installation on your local system, check:
ls $FLINK_HOME/lib/
- Look for a file like:
flink-sql-gateway-driver-*.jar
- If found, copy it to your local system for DBeaver.
Option 3: Build the Driver from Source (Advanced Users)
If the pre-built JAR is not available, you can build it manually.
Steps to Build from Source
- Clone the Flink repository:
git clone https://github.com/apache/flink.git cd flink
- Build the driver:
mvn clean package -DskipTests -pl flink-table/flink-sql-gateway -am
- After the build completes, the JAR will be located in:
flink-table/flink-sql-gateway/target/flink-sql-gateway-driver-*.jar
- Copy the JAR to your local system.
Adding the JDBC Driver to DBeaver
Once you have the JAR file, follow these steps:
- Open DBeaver
- Go to Database → Driver Manager
- Click New → Enter:
- Driver Name:
Flink JDBC
- Class Name:
org.apache.flink.table.client.gateway.JdbcDriver
- URL Template:
jdbc:flink://<jobmanager-host>:8083
- Driver Name:
- Click Add File, then select the downloaded JDBC JAR file
- Click OK to save
Now, when you create a new connection in DBeaver, you should be able to select Flink JDBC and connect.
Step-by-Step Guide to Access Flink SQL via JDBC in DBeaver
Step 1: Ensure Flink SQL Gateway is Running
Since you're manually starting the SQL Gateway inside the JobManager, verify it's running:
podman exec -it flink-jobmanager ps aux | grep sql-gateway
If it’s not running, start it inside the JobManager container:
podman exec -it flink-jobmanager /opt/flink/bin/sql-gateway.sh start
Check logs to confirm it started successfully:
podman logs flink-jobmanager | grep "Started SQL Gateway"
By default, the Flink SQL Gateway listens on port 8083.
Step 2: Expose Port 8083 (If Not Already Exposed)
Since your SQL Gateway runs inside the JobManager, ensure port 8083 is exposed for external access:
-
Check running ports:
podman port flink-jobmanager
If 8083 is not listed, restart the container with port mapping:
podman stop flink-jobmanager podman rm flink-jobmanager podman run -d --name flink-jobmanager -p 8081:8081 -p 8083:8083 flink:latest jobmanager
-
Verify port accessibility from your machine:
curl http://<jobmanager-host>:8083/v1/info
Replace
<jobmanager-host>
with the actual hostname or IP.
Step 3: Create a New Connection in DBeaver
- Open DBeaver → Click New Database Connection
- Choose Flink JDBC (the one you created above)
- Enter:
- URL:
jdbc:flink://<jobmanager-host>:8083
- Username: (leave empty)
- Password: (leave empty)
- URL:
- Click Test Connection
- If successful, click Finish
Step 4: Execute Flink SQL Queries in DBeaver
Now, you can execute SQL queries in DBeaver’s SQL Editor, like:
SHOW TABLES;
SELECT * FROM my_kafka_table LIMIT 10;
Troubleshooting
If you get a driver error:
- Check SQL Gateway logs
podman logs flink-jobmanager | grep "SQL Gateway"
- Ensure JDBC driver is added in DBeaver
- Verify Flink SQL Gateway is reachable
curl http://<jobmanager-host>:8083/v1/info
- Restart SQL Gateway if needed
podman exec -it flink-jobmanager /opt/flink/bin/sql-gateway.sh stop podman exec -it flink-jobmanager /opt/flink/bin/sql-gateway.sh start
Now your Flink SQL Gateway should be accessible via JDBC in DBeaver.