Fork me on GitHub
#datomic
<
2020-07-17
>
mafcocinco15:07:29

Is there a way to fetch the Datomic version that is running using a Datalog query? In Postgres, for example, I can run SELECT version(); to get the version string/info about the Postgres instance that is processing the query.

defa16:07:07

I’d like to build a small command line jar tool to wipe a datomic database on the transactor. I bundled the Postgres JDBC driver and excluded the H2 driver but the tool will access the h2 driver anyways. Any ideas?

defa16:07:51

Exception in thread "main" java.lang.ExceptionInInitializerError
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:398)
...
	at datomic.coordination$loading__5569__auto____8224.invoke(coordination.clj:4)
	at datomic.coordination__init.load(Unknown Source)
	at datomic.coordination__init.<clinit>(Unknown Source)
...
Caused by: java.lang.ClassNotFoundException: org.h2.tools.Server
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:398)
	at clojure.lang.RT.classForName(RT.java:2211)
	at clojure.lang.RT.classForNameNonLoading(RT.java:2224)
	at datomic.h2$loading__5569__auto____8226.invoke(h2.clj:4)
	at datomic.h2__init.load(Unknown Source)
	at datomic.h2__init.<clinit>(Unknown Source)
	... 117 more

defa16:07:05

deps.end:

{:paths     ["src" "resources"]
 :mvn/repos {"" {:url ""}}

 :deps      {org.clojure/clojure       {:mvn/version "1.10.1"}
             com.datomic/datomic-pro   {:mvn/version "1.0.6165"
                                        :exclusions  [com.h2database/h2]}
             org.postgresql/postgresql {:mvn/version "9.3-1102-jdbc41"}}

 :aliases   {:uberjar {:extra-deps {seancorfield/depstar {:mvn/version "0.5.1"}}
                       :main-opts  ["-m" "hf.depstar.uberjar" "wipedb.jar"
                                    "-C" "-m" "tools.wipedb"]}}}

defa16:07:44

and wipedb just takes a the main args and calls (datomic.api/delete-database (first gargs))

favila16:07:47

I don’t think you can drop that dependency

favila16:07:00

Other than tidiness, is there a reason you want to specifically exclude h2?

defa16:07:28

Yes, because when running clj -A:uberjar I get an error that the java.sql.Driver clashes…

defa16:07:05

I’ll try to not put the postgres jdbc in the uberjar… and add it to the classpath.

defa16:07:14

Ah, that’s the solution. You can not bundle the jdbc-driver jar with the uberjar…

defa16:07:37

Anyway, thanks for replying!

Will18:07:13

Is there a way to "un-register" a transactor with a database?