Kodo JDO can be used with any third-party javax.sql.DataSource. There are 2 primary ways of telling Kodo JDO about a DataSource:
Bind the DataSource into JNDI, and then specify its location in the javax.jdo.option.ConnectionFactoryName property.
Specify the full class name of the DataSource implementation in the javax.jdo.option.ConnectionDriverName property in place of a JDBC driver. In this configuration Kodo JDO will instantiate an instance of the named class via reflection. It will then configure the DataSource with the properties in the kodo.ConnectionProperties setting.
Some advanced features of Kodo JDO's own DataSource can also be used with third-party implementations. Kodo JDO layers on top of the third-party DataSource to provide the extra functionality. To configure these advanced features, including prepared statement caching, use the kodo.ConnectionFactoryProperties property described in the previous section.
Example 4.2. Properties File for a Third-Party DataSource
javax.jdo.option.ConnectionDriverName: oracle.jdbc.pool.OracleDataSource kodo.ConnectionProperties: PortNumber=1521, ServerName=saturn, \ DatabaseName=solarsid, DriverType=thin kodo.ConnectionFactoryProperties: QueryTimeout=5000
Certain application servers automatically enlist their data sources in global transactions. When this is the case, Kodo should not attempt to commit the underlying connection, leaving JDBC transaction completion to the application server. To notify Kodo that your third-party data source will automatically be enlisted in transactions, set the kodo.jdbc.DataSourceMode property to enlisted:
kodo.jdbc.DataSourceMode: enlisted
Note that Kodo can only use enlisted data sources when it is also integrating with the application server's managed transactions, as discussed in Section 13.1, “Integrating with the Transaction Manager”. Also note that all XA data sources are enlisted data sources, and you must set this property when using an XA data source. XA transactions are detailed in Section 13.2, “XA Transactions”.