Kodo JDO can take advantage of any JDBC 1.x compliant driver, making almost any major database a candidate for use. See our officially supported database list for more information. Typically, Kodo JDO auto-configures its JDBC behavior and SQL for your database, based on the values of your connection-related JDO configuration properties.
If Kodo JDO cannot detect what type of database you are using, or if you are using an unsupported database, you will have to tell Kodo JDO what kodo.jdbc.sql.DBDictionary to use. The DBDictionary abstracts away the differences between databases. You can plug a dictionary into Kodo JDO using the kodo.jdbc.DBDictionary configuration property. The built-in dictionaries are listed below. If you are using an unsupported database, you may have to write your own DBDictionary subclass, a simple process.
access: Dictionary for Microsoft Access. This is an alias for the kodo.jdbc.sql.AccessDictionary class.
db2: Dictionary for IBM's DB2 database. This is an alias for the kodo.jdbc.sql.DB2Dictionary class.
foxpro: Dictionary for Microsoft Viual FoxPro. This is an alias for the kodo.jdbc.sql.FoxProDictionary class.
hsql: Dictionary for the Hypersonic SQL database. This is an alias for the kodo.jdbc.sql.HSQLDictionary class.
informix: Dictionary for the Informix database. This is an alias for the kodo.jdbc.sql.InformixDictionary class.
jdatastore: Dictionary for Borland JDataStore. This is an alias for the kodo.jdbc.sql.JDataStoreDictionary class.
mysql: Dictionary for the MySQL database. This is an alias for the kodo.jdbc.sql.MySQLDictionary class.
oracle: Dictionary for Oracle. This is an alias for the kodo.jdbc.sql.OracleDictionary class.
pointbase: Dictionary for Pointbase Embedded database. This is an alias for the kodo.jdbc.sql.PointbaseDictionary class.
postgres: Dictionary for PostgreSQL. This is an alias for the kodo.jdbc.sql.PostgresDictionary class.
sqlserver: Dictionary for Microsoft's SQLServer database. This is an alias for the kodo.jdbc.sql.SQLServerDictionary class.
sybase: Dictionary for Sybase. This is an alias for the kodo.jdbc.sql.SybaseDictionary class.
The standard dictionaries all recognize the following properties. These properties will usually not need to be overridden, since the dictionary implementation should use the appropriate default values for your database:
CreatePrimaryKeys: If false, then do not create database primary keys for identifiers. Defaults to true.
SchemaCase: Set this property to "upper", "lower", "preserve", or "default", depending on whether the database will internally represent schema names in upper-case, lower-case, or if it handles case-sensitive names. The default setting is the default case-handling for the database, as reported by the database's metadata.
StoreLargeNumbersAsStrings: Many databases have limitations on the number of digits that can be stored in a numeric field (for example, Oracle can only store 38 digits). For applications that operate on very large BigInteger and BigDecimal values, it may be necessary to store these objects as string fields rather than the database's numeric type. Note that this may prevent meaningful numeric queries from being executed against the database. Defaults to false.
StoreCharsAsNumbers: Set this property to false to store Java char fields as CHAR values rather than numbers. Defaults to true.
SimulateLocking: Some databases do not support pessimistic locking, which will result in a JDOException when a pessimistic transaction is attempted. Setting this property to true will bypass the locking check to allow pessimistic transactions even on databases that do not support locking. Defaults to false.
JoinSyntax: The SQL join syntax to use in select statements. The available settings are:
traditional: Traditional SQL join syntax; outer joins are not supported.
database: The database's native join syntax. Databases that do not have a native syntax will default to one of the other options.
sql92: ANSI SQL92 join syntax. Outer joins are supported. Not all databases support this syntax.
BatchLimit: The maximum number of SQL update statements to batch together. Set to 0 to disable SQL batching, or -1 for no limit.
BatchParameterLimit: The maximum number of total parameters that can be batched together for a single batch update. Some databases can only handle a certain total number of prepared statement parameters in a single batch. This value will cause Kodo to flush a SQL batch once the number of batched statements times the number of bound parameters per statement exceeds this value. Set to 0 to disable SQL batching, or -1 for no limit.
SystemTables: Comma-separated list of table names that should be excluded when reflecting on the database. This list will be added to the default list of system tables, which is database-dependent.
SystemSchemas: Comma-separated list of schema names that should be excluded when reflecting on the database. This list will be added to the default list of system schemas, which is database-dependent.
TableTypes: Comma-separated list of table types to use when looking for tables during schema reflection, as defined in the java.sql.DatabaseMetaData.getTableInfo JDBC method. An example is: "TABLE,VIEW,ALIAS". Defaults to "TABLE".
AutoIncrementClause: The column defintion clause to append to a creation statement. For example, "AUTO_INCREMENT" for MySQL. This property is set automatically in the dictionary, and should not need to be overridden, and is only used when the schema is generated using the mappingtool.
AutoIncrementTypeName: The column type name for auto-increment columns. For example, "SERIAL" for PostgreSQL. This property is set automatically in the dictionary, and should not need to be overridden, and is only used when the schema is generated using the mappingtool.
LastGeneratedKeyQuery: The query to issue to obtain the last automatically generated key for an auto-increment column. For example, "select @@identity" for Sybase. This property is set automatically in the dictionary, and should not need to be overridden.
StorageLimitationsFatal: If true, than any data truncation/rounding that is performed by the dictionary in order to store the value in the database will be treated as a fatal error, rather than just issuing a warning.
SupportsDeferredConstraints: If true, then constraints will be generated as being deferrable when appropriate.
SupportsForeignKeys: If true, then the database supports foreign keys.
SupportsMultipleNontransactionalResultSets: If true, then a nontransactional connection is capabile of having multiple open ResultSet instances.
SupportsSelectForUpdate: If true, then the database supports SELECT statements with a pessimistic locking clause.
SupportsLockingWithDistinctClause: If true, then the database supports FOR UPDATE select clauses with DISTINCT clauses.
SupportsLockingWithOuterJoin: If true, then the database supports FOR UPDATE select clauses with outer join queries.
SupportsLockingWithInnerJoin: If true, then the database supports FOR UPDATE select clauses with inner join queries.
SupportsLockingWithMultipleTables: If true, then the database supports FOR UPDATE select clauses that select from multiple tables.
SupportsLockingWithOrderClause: If true, then the database supports FOR UPDATE select clauses with ORDER BY clauses.
MaxIndexesPerTable: The maximum number of indexes that can be created for a table.
MaxKeyNameLength: The maximum length of any primary or foreign key name.
UseGetBestRowIdentifierForPrimaryKeys: If true, then metadata queries will use DatabaseMetaData.getBestRowIdentifier to obtain information about primary keys, rather than DatabaseMetaData.getPrimaryKeys.
UseGetBytesForBlobs: If true, then ResultSet.getBytes will be used to obtain blob data rather than ResultSet.getBinaryStream.
UseGetObjectForBlobs: If true, then ResultSet.getObject will be used to obtain blob data rather than ResultSet.getBinaryStream.
UseSetBytesForBlobs: If true, then PreparedStatement.setBytes will be used to set blob data, rather than PreparedStatement.setBinaryStream.
UseStringsForClobs: If true, then ResultSet.getString will be used to obtain blob data rather than ResultSet.getCharacterStream.
ValidationSQL: The default SQL that is used by validate that a connection is still in a valid state. For example, "SELECT SYSDATE FROM DUAL" for Oracle.
ReservedWords: A comma-separated list of words that are reserved by this database (in addition to the ones that are reported by the metadata).
ForUpdateClause: The clause to append to SELECT statements to issue queries that obtain pessimistic locks. Defaults to "FOR UPDATE".
TableForUpdateClause: The clause to append to the end of each table alias in queries that obtain pessimistic locks.
SupportsNullTableForGetColumns: If true, then the database supports passing a null parameter to DatabaseMetaData.getColumns as an optimization to get information about all the tables. Defaults to true.
SupportsNullTableForGetPrimaryKeys: If true, then the database supports passing a null parameter to DatabaseMetaData.getPrimaryKeys as an optimization to get information about all the tables. Defaults to false.
SupportsNullTableForGetIndexInfo: If true, then the database supports passing a null parameter to DatabaseMetaData.getIndexInfo as an optimization to get information about all the tables. Defaults to false.
SupportsNullTableForGetImportedKeys: If true, then the database supports passing a null parameter to DatabaseMetaData.getImportedKeys as an optimization to get information about all the tables. Defaults to false.
InitializationSQL: A piece of SQL to issue against the database whenever a connection is retrieved from the DataSource. Defaults to null.
CatalogSeparator: The character the database uses to delimit between the schema name and the table name. This is typically ".", and defaults to the value returned from the JDBC driver's database metadata.
UseSchemaName: If false, then avoid including the schema name in table name references. Defaults to true.
BigintTypeName: The overridden default column type for java.sql.Types.BIGINT. This is only used when the schema is generated by the mappingtool.
BinaryTypeName: The overridden default column type for java.sql.Types.BINARY. This is only used when the schema is generated by the mappingtool.
BitTypeName: The overridden default column type for java.sql.Types.BIT. This is only used when the schema is generated by the mappingtool.
BlobTypeName: The overridden default column type for java.sql.Types.BLOB. This is only used when the schema is generated by the mappingtool.
CharTypeName: The overridden default column type for java.sql.Types.CHAR. This is only used when the schema is generated by the mappingtool.
ClobTypeName: The overridden default column type for java.sql.Types.CLOB. This is only used when the schema is generated by the mappingtool.
DateTypeName: The overridden default column type for java.sql.Types.DATE. This is only used when the schema is generated by the mappingtool.
DecimalTypeName: The overridden default column type for java.sql.Types.DECIMAL. This is only used when the schema is generated by the mappingtool.
DistinctTypeName: The overridden default column type for java.sql.Types.DISTINCT. This is only used when the schema is generated by the mappingtool.
DoubleTypeName: The overridden default column type for java.sql.Types.DOUBLE. This is only used when the schema is generated by the mappingtool.
FloatTypeName: The overridden default column type for java.sql.Types.FLOAT. This is only used when the schema is generated by the mappingtool.
IntegerTypeName: The overridden default column type for java.sql.Types.INTEGER. This is only used when the schema is generated by the mappingtool.
JavaObjectTypeName: The overridden default column type for java.sql.Types.JAVAOBJECT. This is only used when the schema is generated by the mappingtool.
LongVarbinaryTypeName: The overridden default column type for java.sql.Types.LONGVARBINARY. This is only used when the schema is generated by the mappingtool.
LongVarcharTypeName: The overridden default column type for java.sql.Types.LONGVARCHAR. This is only used when the schema is generated by the mappingtool.
NullTypeName: The overridden default column type for java.sql.Types.NULL. This is only used when the schema is generated by the mappingtool.
NumericTypeName: The overridden default column type for java.sql.Types.NUMERIC. This is only used when the schema is generated by the mappingtool.
OtherTypeName: The overridden default column type for java.sql.Types.OTHER. This is only used when the schema is generated by the mappingtool.
RealTypeName: The overridden default column type for java.sql.Types.REAL. This is only used when the schema is generated by the mappingtool.
RefTypeName: The overridden default column type for java.sql.Types.REF. This is only used when the schema is generated by the mappingtool.
SmallintTypeName: The overridden default column type for java.sql.Types.SMALLINT. This is only used when the schema is generated by the mappingtool.
StructTypeName: The overridden default column type for java.sql.Types.STRUCT. This is only used when the schema is generated by the mappingtool.
TimeTypeName: The overridden default column type for java.sql.Types.TIME. This is only used when the schema is generated by the mappingtool.
TimestampTypeName: The overridden default column type for java.sql.Types.TIMESTAMP. This is only used when the schema is generated by the mappingtool.
TinyintTypeName: The overridden default column type for java.sql.Types.TINYINT. This is only used when the schema is generated by the mappingtool.
VarbinaryTypeName: The overridden default column type for java.sql.Types.VARBINARY. This is only used when the schema is generated by the mappingtool.
VarcharTypeName: The overridden default column type for java.sql.Types.VARCHAR. This is only used when the schema is generated by the mappingtool.
SupportsSchemaForGetTables: If false, then the database driver does not support using the schema name for schema reflection on table names.
SupportsSchemaForGetColumns: If false, then the database driver does not support using the schema name for schema reflection on column names.
The mysql dictionary also understands the following property:
TableType: The MySQL table type to use when creating tables.
The oracle dictionary understands the following properties:
UseTriggersForAutoIncrement: If true, then Kodo will allow simulation of auto-increment columns by the use of Oracle triggers. Kodo will assume that the current sequence value from the sequence specified in the AutoIncrementSequenceName parameter will hold the value of the new primary key for rows that have been inserted. For more details on auto-increment support, see Example 5.5, “Auto-Increment Object Ids”.
AutoIncrementSequenceName: The global name of the sequence that Kodo will assume to hold the value of primary key value for rows that use auto-increment. If left unset, Kodo will use a the sequence named "SEQ_<table name>".