Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Presto JDBC Connection Pool Creation ERROR "Disabling auto-commit mode not supported"

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>
like image 282
Prem Chand shah Avatar asked Nov 23 '25 18:11

Prem Chand shah


1 Answers

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.

like image 80
Karol Dowbecki Avatar answered Nov 26 '25 10:11

Karol Dowbecki