Fork me on GitHub

I have a question which I’m assuming is trivial. Failed to find a reasonable answer so here we go: I have the following code using next.jdbc to connect to an oracle db:

(def url "jdbc:oracle:thin:@<someip>:<somepord>:<somesid>")
(let [ds   (jdbc/get-datasource {:jdbcUrl url :user "user" :password "pass"})]
  (with-open [c (jdbc/get-connection ds)]
    (println "result:" (jdbc/execute! c ["select 1 from dual"]))))
but when I execute this I get the following exception:
clojure.lang.ExceptionInfo: Method close on class oracle.jdbc.driver.T4CConnection not allowed!
not allowed to close the connection? eh…I have not seen this from other languages using the same jdbc url so I’m thinking I have some misconception about how next.jdbc works. Any help much appreciated


If I skip with-open or send in the db spec {:jdbcUrl .. :user .. :password ..} directly to jdbc/execute! then no exception, but that leaves me wondering if I’m missing cleanup of resources and leaving connections hanging etc


would you not consider using a connection pool library like hikaricp?


it works fantastically well with next jdbc


I could, but would prefer not to as I'm troubleshooting a production stack and trying to not introduce extra pieces in the puzzle


I think that it should be fine


It just stands up the connection from scratch


That's a weird one. It clearly has a .close method, but that is implemented to throw an exception?


@mbjarland Your usage looks correct at first glance but I haven't see folks using :jdbcUrl + :user/`:password` (it should work) and I don't test the library locally with Oracle (because, logistics!). Oracle definitely does a lot of very peculiar things tho'...


Agreed, oracle is a strange beast


And the URL + creds spec works and returns data, it just barfs when trying to close the connection after


And yes, setting up oracle is total voodoo


wow tried to read the decompiled code for T4CConnection and PhysicalConnection which it extends, that is a pretty convoluted process for just closing a connection


If you can figure out why it doesn't work(!) and what the recommended approach for dealing with connection is, once you're done with them (I assume you're supposed to call something to mark the connection "done with"?), feel free to open an issue on the next.jdbc repo with suggestions for the Oracle section of the Tips &amp; Trick page.