Read and write properties

The com.onedb.jdbcx.OneDBDataSource extends the commonly used java.util.Properties class and as such all of the methods of a Properties object can be used to set and get any property from the datasource as a String.

Example adding and getting a property using the Properties methods. You can use a String as the key, or use the com.onedb.jdbcx.OneDBParams constants.

OneDBDataSource ds = new OneDBDataSource();
//both of these set the same property
ds.setProperty("preparedStatementCacheSize", 20);
ds.setProperty(com.onedb.jdbc.OneDBParams.PREPAREDSTATEMENT_CACHE_SIZE, 20);

//example getting the parameter value back, including a default if it is not set.
String cacheSize = ds.getProperty("preparedStatementCacheSize");key, Object value);

Each property supported by the driver also has it's own set/get methods. These methods match the name of the property. The example below shows setting and getting the PreparedStatement cache size property.

// for preparedStatementCacheSize
ds.setPreparedStatementCacheSize(20); //uses int, not String
int cacheSize = ds.getPreparedStatementCacheSize();key);