Fork me on GitHub
Joelle Wakim08:02:33

Hello @seancorfield, insert-multi! fn did the insert in one statement after we upgraded mariadb version to 10.3.11 and changed "org.mariadb.jdbc/mariadb-java-client" dependency version to "2.4.0". Thanks again!


Good to know! Thank you. I suspected it might be a driver issue (since that aspect of behavior is out of the control of java.jdbc.


What is the difference between querying directly with jdbc/query on a hikaricp connection pool and wrapping that call in a with-db-connection ?


Without seeing the OP's code, it's impossible to say what they were doing wrong.


It sounds like they were getting a connection from the pool and then handing it around their app and thus making it long-lived -- and so it was getting closed. If you have a connection pool (your db-spec is a hash map containing :datasource <pooled datasource>) you can use that directly in jdbc/query and it will get a new connection, run the query, and then close the connection.


In that situation, wrapping code in with-db-connection should make no difference.


We use c3p0 at work and our db-spec is a hash map containing :datasource with a c3p0 PooledDatasource object and we pass that hash map directly to jdbc/query all over the place in a highly concurrent, high-traffic app and it's never a problem. Which is why I believe the OP was doing something wrong 😐