Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Database types are defined in Kettle with a unique database id, e.g. SampleDB. Dialects relate one-to-one with database type ids defined in Kettle DB Core or a Kettle Database Plugin. A dialect is an implementation of the SPI org.pentaho.pms.mql.dialect.SQLDialectInterface.:

Code Block
public interface SQLDialectInterface {

  public String getDatabaseType();

  public String quoteStringLiteral(Object str);

  public boolean isSupportedFunction(String functionName);

  public boolean isAggregateFunction(String functionName);

  public boolean isSupportedInfixOperator(String operator);

  public SQLFunctionGeneratorInterface getFunctionSQLGenerator(String functionName);

  public SQLOperatorGeneratorInterface getInfixOperatorSQLGenerator(String operatorName);

  public String getDateSQL(int year, int month, int day);

  public String generateSelectStatement(SQLQueryModel model);

  public int getMaxTableNameLength();
}

...

All that is required is the jar file to be in the classpath. In most applications this is a /lib directory within the application's installation directory.

  • Note: In order to use a dialect the database type must be defined in Kettle. See the sample project for how to register a Kettle Database Plugin.

Sample Source Code

Attached is a sample project with the aforementioned SampleDB Dialect Plugin and a SampleDB Kettle Database Plugin: http://wiki.pentaho.com/download/attachments/19235857/sampledb-plugin.tar.gz

Further Reading

For more general information about Java's ServiceLoader API see these links:

http://download.oracle.com/javase/6/docs/api/java/util/ServiceLoader.html
http://java.sun.com/developer/technicalArticles/javase/extensible/index.html

Sample Source Code

Attached is a sample project with the aforementioned SampleDB Dialect Plugin and a SampleDB Kettle Database PluginFor more information on how to test a Kettle Plugin click here: http://wiki.pentaho.com/downloaddisplay/attachments/19235857/sampledb-plugin.tar.gzFor more information on how to test a Kettle Plugin click here.EAI/How+to+debug+a+Kettle+4+plugin