For the complete documentation index, see llms.txt. This page is also available as Markdown.

Database Connections

Database connections ..

Workshop - Database connections

Database Connection

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) or Cmd+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.

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.

  1. Launch DBeaver and select MySQL.

MySQL
  1. Configure the connection:

  • Username: root

  • Password: password

Configure & Test MySQL connection - sampledata
Enable: allowPublicKeyRetrieval
  1. Test the connection.

Test connection
  1. Expand Databases > sampledata > Tables.

Customer Data
  1. Open a SQL window and run a test query:

Sql query - NYC Customers

Download JDBC Driver

PDI does not ship all JDBC drivers. If your database type is missing, add the driver JAR.

  1. Download the JDBC driver for your database.

  1. Copy the driver JAR into your PDI install:

C:\Pentaho\design-tools\data-integration\lib\

~/Pentaho/design-tools/data-integration/lib/

  1. 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)

  1. Create a transformation.

  2. In Spoon, select File > New > Database connection.

The Database connection dialog opens.

  1. Enter the following details:

  • Connection name: MySQL: sampledata

  • Connection type: MySQL

  • Access: Native (JDBC)

  • Host name: localhost (or your Docker host IP)

  • Database name: sampledata

  • Username: pentaho_admin

  • Password: password

MySQL - sampledata
  1. Select Test.

Checkpoint: Spoon shows a success message.

Share Database Connection

Share the connection so other transformations can reuse it.

  1. Click OK to save your entries and exit the Database Connection dialog box.

  2. From within the View tab, right-click on the connection and select Share from the list that appears.

Share database connection

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.

  1. Click on the View tab, expand Database Connections.

  2. Right-click MySQL:sampledata and choose Explore from the menu options:

Action

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

  1. In the Database Explorer window, expand Sampledata > Tables

Database Explorer - sampledata
  1. Right-click the CUSTOMERS table and choose Preview first 100.

  2. Examine the customer data.

  3. Select View SQL.

SQL
  1. Click Execute.

Execute SQL statement

Last updated

Was this helpful?