Database Connections
Database connections ..
Workshop - Database connections
Create a reusable MySQL connection to the Steel Wheels sampledata database.
What you’ll do
Validate the database is reachable (optional, using DBeaver)
Install a JDBC driver (only if PDI does not include it)
Create, test, share, and explore a PDI database connection
Prerequisites
PDI (Spoon) installed and working
A running
sampledatadatabase (Docker setup recommended)Basic understanding of schemas, tables, and authentication
Estimated time: 15 minutes
Workshop files
Download the following file.
Keep the filename unchanged.
Save it in your workshop folder.
Create a new transformation
Use any of these options to open a new transformation tab:
Select File > New > Transformation
Use
Ctrl+N(Windows/Linux) orCmd+N(macOS)
DBeaver
DBeaver is optional. Use it to confirm the database is reachable before you touch PDI.
DBeaver CE ships with most drivers. That makes it a fast connectivity check.
Pentaho no longer ships a writable sample database user by default.
Use the Docker sampledata setup for hands-on database workshops.
MySQL Database
If you completed the Setup, you should have a MySQL Docker container.
It should be exposed on port 3306 and include the sampledata database.
Launch DBeaver and select MySQL.

Configure the connection:
Username:
rootPassword:
password

You might need to download the supported driver version.
If the test fails, enable allowPublicKeyRetrieval.

Test the connection.

Expand Databases > sampledata > Tables.

Open a SQL window and run a test query:

Checkpoint: you can browse tables and run a query against CUSTOMERS.
Download JDBC Driver
PDI does not ship all JDBC drivers. If your database type is missing, add the driver JAR.
Download the JDBC driver for your database.
Copy the driver JAR into your PDI install:
C:\Pentaho\design-tools\data-integration\lib\
~/Pentaho/design-tools/data-integration/lib/
Restart Spoon.
If your install uses lib/jdbc/, place the JAR there instead.
Pentaho Data Integration Connection
Create the connection once. Reuse it in steps like Table input, Table output, and Database lookup.
In this lab, you connect to the Steel Wheels sampledata database (MySQL).
Define a database connection (MySQL)
Create a transformation.
In Spoon, select File > New > Database connection.
The Database connection dialog opens.

Enter the following details:
If you use a MariaDB driver newer than 2.7.x, you might see a fetch size error.
If that happens, use the MySQL driver instead.
Connection name:
MySQL: sampledataConnection type: MySQL
Access: Native (JDBC)
Host name:
localhost(or your Docker host IP)Database name:
sampledataUsername:
pentaho_adminPassword:
password

Select Test.
Checkpoint: Spoon shows a success message.
Share Database Connection
Share the connection so other transformations can reuse it.
Click OK to save your entries and exit the Database Connection dialog box.
From within the View tab, right-click on the connection and select Share from the list that appears.

Shared connections show up for other users and projects. Use Explore to confirm schemas and tables.
Explore Database
Use Database Explorer to browse schemas, preview rows, and run SQL.
Click on the View tab, expand Database Connections.
Right-click MySQL:sampledata and choose Explore from the menu options:
Preview the first 100 rows of ..
Return the first 100 rows of the selected table.
Preview first .. rows of ..
Enter the number of rows to preview
Number of rows ..
Displays number of rows
Generate DDL
Displays DDL statement that creates table.
Generate DDL for other connection
Select connection to display DDL. Syntax is based on database engine.
Open SQL for ..
Edit SELECT statement
Truncate table
Deletees all the rows from selected table
In the Database Explorer window, expand Sampledata > Tables

Right-click the
CUSTOMERStable and choose Preview first 100.Examine the customer data.
Select View SQL.

Click Execute.

Checkpoint: you can preview CUSTOMERS and execute SQL in Database Explorer.
Last updated
Was this helpful?
