0

I'm writing a sql tool in clojure that should be able to connect to any database. Something like a light version of HeidiSQl or DBeaver.

I'm using next.jdbc.

Unfortunately the documentation states: JDBC drivers are not provided by next.jdbc -- you need to specify the driver(s) you need as additional dependencies in your project.

But I don't want my application to have a dependency to all supported databases. Say for instance I want to support Oracle, MS SQL and PostgreSQL. I can't demand the end-user to have to install all these 3 drivers if he just want to use my application to connect to PostgreSQL.

Pasduti
  • 63
  • 8
  • If you are creating a app / tool, would you not bundle all the drivers into the uberjar. The app would then just load the required driver at runtime. The end-user would not have have to install any of the drivers - they'd be there in the uberjar of the app you provide. Perhaps I'm missing something in your question. – dorab Apr 03 '22 at 22:33
  • You don't need to download _all_ drivers just to work with one DB. JDBC loads the driver on-demand basically when the first connection is attempted. You could also provide means to download the driver for the user (download it into a classpath dir and restart the application, or there are ways to do it [at runtime](https://stackoverflow.com/questions/60764/how-to-load-jar-files-dynamically-at-runtime)) – cfrick Apr 04 '22 at 08:24
  • Just to be clear : This is a clojure application. And the documentations states that I should add the drivers to the dependencies (in project.clj). So basically, like @dorab proposed, I should add all drivers as dependencies. And include them in the uberjar too. – Pasduti Apr 04 '22 at 21:59

0 Answers0