Feed Lakebase Data into FineReport
The CData JDBC Driver for Lakebase fully implements the JDBC standard and can provide Lakebase data connectivity to a wide variety of BI, reporting, and ETL tools and custom applications. In this article, we explain how to set Lakebase data as JDBC data source in FineReport and view Lakebase data as a table in the Report Designer.
Set Up a JDBC Data Source of Lakebase Data
Follow the instruction below to set Lakebase data as a FineReport database connection.
- Copy the cdata.jdbc.lakebase.jar file from the lib folder in the CData JDBC Driver for Lakebase installation directory to the lib folder of the FineReport installation directory. You will need to copy the cdata.jdbc.lakebase.lic file as well.
- From the Server tab, select Define Data Connection, click to add a new connection, and click JDBC.
Next we will set up the data connection definition in the window.
- Database: Others
- JDBC Driver: cdata.jdbc.lakebase.LakebaseDriver
-
URL: A standard JDBC connection string using semicolon-separated connection properties.
To connect to Databricks Lakebase, start by setting the following properties:
- DatabricksInstance: The Databricks instance or server hostname, provided in the format instance-abcdef12-3456-7890-abcd-abcdef123456.database.cloud.databricks.com.
- Server: The host name or IP address of the server hosting the Lakebase database.
- Port (optional): The port of the server hosting the Lakebase database, set to 5432 by default.
- Database (optional): The database to connect to after authenticating to the Lakebase Server, set to the authenticating user's default database by default.
OAuth Client Authentication
To authenicate using OAuth client credentials, you need to configure an OAuth client in your service principal. In short, you need to do the following:
- Create and configure a new service principal
- Assign permissions to the service principal
- Create an OAuth secret for the service principal
For more information, refer to the Setting Up OAuthClient Authentication section in the Help documentation.
OAuth PKCE Authentication
To authenticate using the OAuth code type with PKCE (Proof Key for Code Exchange), set the following properties:
- AuthScheme: OAuthPKCE.
- User: The authenticating user's user ID.
For more information, refer to the Help documentation.
Built-in Connection String Designer
For assistance in constructing the JDBC URL, use the connection string designer built into the Lakebase JDBC Driver. Either double-click the JAR file or execute the jar file from the command-line.
java -jar cdata.jdbc.lakebase.jar
Fill in the connection properties and copy the connection string to the clipboard.
When you configure the JDBC URL, you may also want to set the Max Rows connection property. This will limit the number of rows returned, which is especially helpful for improving performance when designing reports and visualizations.
A typical JDBC URL is below:
jdbc:lakebase:DatabricksInstance=lakebase;Server=127.0.0.1;Port=5432;Database=my_database;InitiateOAuth=GETANDREFRESH; - Click Connection pool attributes and set Test before getting connections to No.
Click Test connection to ensure you have configured the connection properly. With the connection to Lakebase set up, you can use it as FineReport data source.
Select Lakebase Data in the Report Designer.
- Click to add a new template data set and select DB query to open the database query window.
- Choose the JDBC connection that you created from the dropdown list.
- The Lakebase entities will appear as tables on the left pane.
- Write a SELECT statement for the Lakebase data tables and columns that you want to load.
- Click preview and data is shown as table.
With these simple steps, Lakebase can be used as a JDBC data source in FineReport.