0

I tried using BoneCP to pool Vertica connections but am running into errors

[BoneCP-pool-watch-thread-vertica pool] ERROR com.jolbox.bonecp.PoolWatchThread - Error in trying to obtain a connection. Retrying in 7000ms
java.sql.SQLException: [Vertica][JDBC](11760) Cannot call setReadOnly while Connection is in a transaction.
    at com.jolbox.bonecp.ConnectionHandle.setReadOnly(ConnectionHandle.java:1279)
    at com.jolbox.bonecp.ConnectionHandle.<init>(ConnectionHandle.java:254)
    at com.jolbox.bonecp.ConnectionHandle.<init>(ConnectionHandle.java:185)
    at com.jolbox.bonecp.PoolWatchThread.fillConnections(PoolWatchThread.java:114)
    at com.jolbox.bonecp.PoolWatchThread.run(PoolWatchThread.java:81)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)

This is the code I am using

    BoneCPConfig bvcp = new BoneCPConfig();
    Class.forName("com.vertica.jdbc.Driver");
    bvcp.setPoolName("vertica pool");
    bvcp.setDefaultReadOnly(false);
    bvcp.setJdbcUrl("jdbc:vertica://vertica-server:5433/schema");
    bvcp.setUser("username");
    bvcp.setPassword("vertica-pwd");

    BoneCPDataSource bds = new BoneCPDataSource(bvcp);

    JdbcTemplate template = new JdbcTemplate(ds);

    List<Map<String, Object>> ret = template
                .queryForList("select * from table1 ");

I tried the same code with Oracle and HSQL and it works fine.

this is with Vertica JDBC driver 5.1.1 and BoneCP 0.8.0-rc1

Any help is greatly appreciated.

mzzzzb
  • 1,422
  • 19
  • 38

1 Answers1

0

This problem was resolved after I upgraded vertica JDBC driver to 6.1.2

Apparently in 5.1.1 transaction is started immediately after connection is made.

mzzzzb
  • 1,422
  • 19
  • 38