sql

All things SQL and JDBC...
2021-01-20T15:34:42.085900Z

I've got a database where access is controlled not with a password but with kerberos. Are there any examples of connecting to a database like this with clojure?

seancorfield 2021-01-20T17:58:23.086500Z

@bill.h.tucker_slack Look up how to access it via JDBC. You should be able to apply that to Clojure.

✅ 1
seancorfield 2021-01-21T16:12:03.000800Z

Sorry @bill.h.tucker_slack I just meant, if you know the properties used for JDBC, just pass them in a hash map for Clojure:

props.setProperty(
      OracleConnection.CONNECTION_PROPERTY_THIN_NET_AUTHENTICATION_SERVICES,
      "( " + AnoServices.AUTHENTICATION_KERBEROS5 + " )");
    props.setProperty(
      OracleConnection.CONNECTION_PROPERTY_THIN_NET_AUTHENTICATION_KRB5_MUTUAL,
      "true");
That's the relevant bit so it is looking for
{:dbtype "oracle", 
 :dbname "yourdb", 
 OracleConnection/CONNECTION_PROPERTY_THIN_NET_AUTHENTICATION_SERVICES (str "(" AnoServices/AUTHENTICATION_KERBEROS5 ")"),
 OracleConnection/CONNECTION_PROPERTY_THIN_NET_AUTHENTICATION_KRB5_MUTUAL "true"}
and you also need to invoke
(System/setProperty "java.security.krb5.conf" "path/to/your/krb5.conf")
before you call next.jdbc/get-datasource on that db-spec hash map.

seancorfield 2021-01-21T16:12:31.001100Z

Something like that should work.