seancorfield / next-jdbc

A modern low-level Clojure wrapper for JDBC-based access to databases.
https://cljdoc.org/d/com.github.seancorfield/next.jdbc/
Eclipse Public License 1.0
760 stars 90 forks source link

jdbc-url jtds #167

Closed ppiersanti closed 3 years ago

ppiersanti commented 3 years ago

The Jtds driver throws exception receiving the jdbc connection string produced by (next.jdbc.connection/jdbc-url db-spec), which uses & as params separator, whereas jtds wants ;

This works

"jdbc:jtds:sqlserver://192.168.1.1:1433/mydb;password=mypw;user=myuser;useLOBs=false"

This does not work "jdbc:jtds:sqlserver://192.168.1.1:1433/mydb&password=mypw&user=myuser&useLOBs=false"

The error output: Execution error (IOException) at net.sourceforge.jtds.jdbc.TdsCore/sendMSLoginPkt (TdsCore.java:1976).
GSS Failed: Invalid name provided (Mechanism level: KrbException: Cannot locate default realm)

Dependencies involved com.github.seancorfield/next.jdbc {:mvn/version "1.2.659"} net.sourceforge.jtds/jtds {:mvn/version "1.3.1"}

seancorfield commented 3 years ago

First off, just to confirm:

(next.jdbc.connection/jdbc-url {:dbtype "jtds" :dbname "mydb" :host "192.168.1.1" :user "myuser" :password "mypw" :useLOBs false})

produces:

"jdbc:jtds:sqlserver://192.168.1.1:1433/mydb?user=myuser&password=mypw&useLOBs=false"

with a ? in that first slot, not & (which is what you have in your example).

Based on a quick search, requiring ; separator in a "URL" trips a lot of people up, but it's true of both Microsoft's SQL Server JDBC driver and the jTDS driver. MySQL and PostgreSQL both use regular URL formats.

I'll have a think about how best to support this.

ppiersanti commented 3 years ago

On 6/9/21 6:13 PM, Sean Corfield wrote:

First off, just to confirm:

(next.jdbc.connection/jdbc-url {:dbtype "jtds" :dbname "mydb" :host "192.168.1.1" :user "myuser" :password "mypw" :useLOBs false})

produces:

"jdbc:jtds:sqlserver://192.168.1.1:1433/mydb?user=myuser&password=mypw&useLOBs=false"

with a |?| in that first slot, not |&| (which is what you have in your example).

Yes, I confirm that, sorry to confuse you!

Based on a quick search, requiring |;| separator in a "URL" trips a lot of people up, but it's true of both Microsoft's SQL Server JDBC driver and the jTDS driver. MySQL and PostgreSQL both use regular URL formats.

yes, I do use MySQL and PostgreSQL as well and everything works fine.

I'll have a think about how best to support this.

Thank you for your support!

Paolo

seancorfield commented 3 years ago

As soon as #166 is complete, I'll cut a new release. In the meantime, you can use this fix via :git/url in deps.edn if you want to try it out.

ppiersanti commented 3 years ago

yes, it works! 👍

thank you very much!

On 6/10/21 4:16 AM, Sean Corfield wrote:

As soon as #166 https://github.com/seancorfield/next-jdbc/issues/166 is complete, I'll cut a new release. In the meantime, you can use this fix via |:git/url| in |deps.edn| if you want to try it out.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/seancorfield/next-jdbc/issues/167#issuecomment-858227146, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADAEGQDCCTSG4DM2WKCUQ6DTSAOAFANCNFSM46MBZO5A.