Reputation: 26598
I have this bean:
public DataSource getDatsource() throws SQLException {
OracleDataSource dataSource = new OracleDataSource();
dataSource.setUser(userName);
dataSource.setPassword(password);
dataSource.setURL(wallet);
Properties props = new Properties();
props.put("AutoCommit", false); // not working
dataSource.setConnectionProperties(props );
return dataSource;
}
I would set up datasource like all the connection generated from it, has auto commit to false.
How can I do it?
PS I know -Doracle.jdbc.autoCommitSpecCompliant=false
and works, but I would set the property hard coded.
Thanks.
Upvotes: 0
Views: 3901
Reputation: 4640
The value should be a String not a Boolean:
props.put(OracleConnection.CONNECTION_PROPERTY_AUTOCOMMIT, "false");
Upvotes: 0
Reputation: 26598
Solution:
public DataSource getDefaultDataSource() throws SQLException {
OracleDataSource dataSource = new OracleDataSource();
dataSource.setUser(userName);
dataSource.setPassword(password);
dataSource.setURL(wallet);
Properties props = new Properties();
props.put("oracle.jdbc.autoCommitSpecCompliant", "false");
dataSource.setConnectionProperties(props );
return dataSource;
}
Upvotes: 1