I am trying to use Spring-JDBC to connect to Presto and I am using Hikari CP for datasource. Here is my configuration:
@Bean
public DataSource myDataSource() {
HikariDataSource hikariDataSource = new HikariDataSource();
hikariDataSource.setDriverClassName("com.facebook.presto.jdbc.PrestoDriver");
hikariDataSource.setJdbcUrl("xxxxxxx");
hikariDataSource.setMaximumPoolSize(10);
hikariDataSource.setMinimumIdle(5);
hikariDataSource.setIdleTimeout(10000);
hikariDataSource.setConnectionTimeout(60000);
hikariDataSource.setUsername("xxxx");
hikariDataSource.setPassword("xxxx");
hikariDataSource.setAutoCommit(false);
return hikariDataSource;
}
While autowiring the datasource in my service class, I am getting this error:
java.sql.SQLFeatureNotSupportedException: Disabling auto-commit mode not supported
at com.facebook.presto.jdbc.PrestoConnection.setAutoCommit(PrestoConnection.java:126) ~[presto-jdbc-0.163.jar:0.163]
Dependencies: for Springboot base 1.5.10.RELEASE
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>2.7.8</version>
</dependency>
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-jdbc</artifactId>
<version>0.163</version>
</dependency>
You are disabling auto commit mode in line:
hikariDataSource.setAutoCommit(false);
while your Presto driver is not supporting this operation and will throw an exception. Remove the the setAutoCommit(false) from your @Bean. This is discussed in an open issue #3592.
Another option would be to update the driver to newer version as on master the auto commit is already handled in PrestoConnection. Latest version is 0.197.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With