PDI uses database plugins to support specific database systems beyond generic JDBC functionality.
A database plugin helps in the following areas:
- Constructing connection strings
- Passing connection settings to JDBC
- Dialect-aware SQL generation
- Detecting special abilities and limitations of JDBC drivers
Understanding database plugins
A database plugin introduces a new entry in the PDI database dialog box.
This section explains the architecture and programming concepts for creating your own database plugin. We recommend that you open and refer to the sample database plugin sources while following these instructions.
PDI database plugins consist of a single Java class that implements the interface org.pentaho.di.core.database.DatabaseInterface.
In order for PDI to recognize the database plugin, the class implementing
DatabaseInterface must also be annotated with the Java annotation org.pentaho.di.core.plugins.DatabaseMetaPlugin.
Supply these annotation attributes.
A globally unique ID for database plugin
The label to use in the database dialog box
It is recommended to extend org.pentaho.di.core.database.BaseDatabaseMeta, which provides default
implementations for most of the methods in
interfaces are a great source of information when developing a new database plugin.
The following section classifies some of the most commonly overridden methods. They can be roughly classified into three subject areas: information about connections, SQL dialect, and general capability flags.
These methods are called when PDI establishes a connection to the database, or the database dialog is populated with database-specific defaults.
public String getDriverClass()
public int getDefaultDatabasePort()
public int getAccessTypeList()
public boolean supportsOptionsInURL()
public String getURL()
These methods are called when PDI constructs SQL.
public String getFieldDefinition()
public String getAddColumnStatement()
public String getSQLColumnExists()
public String getSQLQueryFields()
These methods are called when PDI determines the run-time characteristics of the database system. For instance, the database systems may support different notions of metadata retrieval.
public boolean supportsTransactions()
public boolean releaseSavepoint()
public boolean supportsPreparedStatementMetadataRetrieval()
public boolean supportsResultSetMetadataRetrievalOnly()
Exploring existing database implementations
PDI sources are
invaluable when seeking example implementations of databases. Each of the PDI core database support
classes is located in the
org.pentaho.di.core.database package found in the
For example, here are the classes that define behavior for some major database systems.
When implementing a database plugin for a new database system, we recommended starting from an existing database class that already shares characteristics with the new database system.
Deploying database plugins
Create a JAR file containing your plugin class(es).
Create a new folder, give it a meaningful name, and place your JAR file inside the folder.
Place the plugin folder you just created in a specific location for PDI to find.Depending on how you use PDI, you need to copy the plugin folder to one or more locations as per the following list.
- Deploying to the PDI client or Carte: Copy the plugin folder into design-tools/data-integration/plugins/databases, then restart the PDI client. After restarting the PDI client, the new database type is available from the PDI database dialog box.
- Deploying to the Pentaho Server for Data Integration: Copy the plugin folder into server/pentaho-server/pentaho-solutions/system/kettle/plugins/databases, then restart the server. After restarting the Pentaho Server, the plugin is available to the server.
- Deploying to Pentaho Server for Business Analytics: Copy the plugin folder into server/pentaho-server/pentaho-solutions/system/kettle/plugins/databases, then restart the server. After restarting thePentaho Server, the plugin is available to the server.
When deploying database plugins, make sure to also deploy the corresponding JDBC drivers. See Specify data connections for the Pentaho Server for instructions about adding JDBC drivers.
Sample database plugin
The sample database plugin registers the CSV JDBC driver from http://csvjdbc.sourceforge.net/ as a database in PDI. This enables reading from CSV files in a directory using basic SQL.
The included sample transformation in demo_transform/demo_database.ktr uses the database plugin to read a basic CSV file through JDBC.
Follow these steps in order to build and deploy the sample plugin.
Obtain the sample plugin source.The database plugin source is available in the download package. Download the package and unzip it. The database plugin resides in the kettle-sdk-database-plugin folder.
Configure the build by opening kettle-sdk-database-plugin/build/build.properties and setting the kettle-dir property to the base directory of your PDI installation.
Build and deploy.You may choose to build and deploy the plugin from the command line, or work with the Eclipse IDE instead. Both options are described below.
You can test the new plugin using the transformation from the database plugin demo_transform folder.
Build and deploy sample database plugin from the command line
The plugin is built using Apache Ant. Build and deploy the plugin from the command line by invoking the install target from the build directory.
kettle-sdk-database-plugin $ cd build build $ ant install
The install target compiles the source, creates a JAR file, creates a plugin folder, and copies the plugin folder into the plugins/databases directory of your PDI installation. It also copies csvjdbc.jar to PDI's lib/ directory, which provides the JDBC driver the plugin depends on.
Build and deploy sample database plugin from Eclipse
Before you begin
- From the menu, select .
- Browse to the kettle-sdk-database-plugin folder and choose the project to be imported.
Open the Ant view in Eclipse by selecting from the main menu and select Ant.You may have to select if you have not used the Ant view before.
Drag the file build/build.xml from your project into the Ant view, and execute the install target by double-clicking it.
After the plugin has been deployed, restart the PDI client.