Creating Database Plugins
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
A database plugin introduces a new entry in the PDI database dialog.
This section explains the architecture and programming concepts for creating your own database plugin. We recommended 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
In order for PDI to recognize the database plugin, the class implementing
DatabaseInterface must also be annotated with the Java annotation
Supply these annotation attributes.
||A globally unique ID for database plugin|
||The label to use in the database dialog|
It is recommended to extend
org.pentaho.di.core.database.BaseDatabaseMeta, which provides default implementations for most of the methods in
DatabaseInterface. Existing PDI database 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.
1. Connection Details
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()
2. SQL Generation
These methods are called when PDI constructs SQL.
public String getFieldDefinition()
public String getAddColumnStatement()
public String getSQLColumnExists()
public String getSQLQueryFields()
3. Capability Flags
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()