sql

All things SQL and JDBC...
2021-02-18T18:48:39.120900Z

Hi, I’m using clojure.java.jdbc with jtds in a somewhat older project, and because of some changes in the data volume, the queries are getting way too slow. The reason seems to be this: http://www.jochenhebbrecht.be/site/2014-05-01/java/fixing-slow-queries-running-sql-server-using-jpa-hibernate-and-jtds. If I “manually” plug my parameters into the query, it’s fast again, but I can’t figure out how to pass the property in the connection map.

seancorfield 2021-02-18T19:07:57.121400Z

@mathias_dw just add :sendStringParametersAsUnicode false to your db-spec hash map?

2021-02-18T19:09:26.122200Z

oh that’s what i tried but it didn’t speed up in the same way as when i manually inserted them into the query string

2021-02-18T19:10:03.122800Z

but thanks a lot for the quick reply, @seancorfield! I’ll try it again.

2021-02-18T19:30:34.123200Z

(tried again from scratch with the parameter added, but no improvement)

seancorfield 2021-02-18T19:52:22.124200Z

Sorry, not sure what to suggest then. Are you building a connection pool, or just relying on c.j.j creating a connection directly from the db-spec hash map?

2021-02-18T20:02:14.125900Z

no worries 🙂 It’s just a connection with the db-spec map. It’s no big deal to manually create the query string, since it’s from a pre-defined list of values.