Fork me on GitHub
#sql
<
2019-02-11
>
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!

seancorfield16:02:33

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.

jsabeaudry23:02:24

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

seancorfield23:02:27

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

seancorfield23:02:54

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.

seancorfield23:02:21

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

seancorfield23:02:51

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 😐