Click on Javadoc link to open Javadoc documentation.
Package
org.gridgain.grid.spi.checkpoint.jdbc ![]()
Description
GridJdbcCheckpointSpi ![]()
Configuration
The following configuration parameters can be used to configure GridJdbcCheckpointSpi ![]()
| Setter Method | Description | Optional | Default |
|---|---|---|---|
| setDataSource(DataSource) |
Sets DataSource to use for database access. | No | — |
| setCheckpointTableName(String) |
Sets checkpoint table name. | Yes | CHECKPOINTS |
| setKeyFieldName(String) |
Sets checkpoint key field name. | Yes | NAME |
| setKeyFieldType(String) |
Sets checkpoint key field type. The field should have corresponding SQL string type (VARCHAR, for example). | Yes | VARCHAR(256) |
| setValueFieldName(String) |
Sets checkpoint value field name. | Yes | VALUE |
| setValueFieldType(String) |
Sets checkpoint value field type. Note, that the field should have corresponding SQL BLOB type. The default value is BLOB, won't work for all databases. For example, if using HSQL DB, then the type should be longvarbinary. | Yes | BLOB |
| setExpireDateFieldName(String) |
Sets checkpoint expiration date field name. | Yes | EXPIRE_DATE |
| setExpireDateFieldType(String) |
Sets checkpoint expiration date field type. The field should have corresponding SQL DATETIME type. | Yes | DATETIME |
| setNumberOfRetries(int) |
Sets number of retries in case of any database errors. | Yes | 2 |
| setUser(String) |
Sets checkpoint database user name. Note that authentication will be performed only if both, user and password are set. | Yes | — |
| setPassword(String) |
Sets checkpoint database password. | Yes | — |
Apache DBCP
Apache DBCP
project provides various wrappers for data sources and connection pools. You can use these wrappers as Spring beans to configure this SPI from Spring configuration file. Refer to Apache DBCP
project for more information.
Examples
GridJdbcCheckpointSpi ![]()
GridJdbcCheckpointSpi checkpointSpi = new GridJdbcCheckpointSpi(); javax.sql.DataSource ds = ... // Set datasource. // Set database checkpoint SPI parameters. checkpointSpi.setDataSource(ds); checkpointSpi.setUser("test"); checkpointSpi.setPassword("test"); GridConfigurationAdapter cfg = new GridConfigurationAdapter(); // Override default checkpoint SPI. cfg.setCheckpointSpi(checkpointSpi); // Start grid. GridFactory.start(cfg);
or from Spring XML configuration file:
<bean id="grid.custom.cfg" class="org.gridgain.grid.GridConfigurationAdapter" singleton="true"> ... <property name="checkpointSpi"> <bean class="org.gridgain.grid.spi.checkpoint.database.GridJdbcCheckpointSpi"> <property name="dataSource"><ref bean="anyPoolledDataSourceBean" /></property> <property name="checkpointTableName" value="GRID_CHECKPOINTS" /> <property name="user" value="test" /> <property name="password" value="test" /> </bean> </property> ... </bean>

For more information about using Spring framework for configuration click here.
