I can’t connect the Console with a (local) SQL-backed database. The Console starts and shows the ‘hello’ database but after selecting it I’m getting a “Could not find hello//hello in catalog” exception in the Console log.
Any ideas on what should I be doing differently?
Thanks a lot!
To reproduce:
Install and start Postgres, create user and database:
CREATE ROLE sqluser LOGIN PASSWORD 'sqlpwd';
CREATE DATABASE sqldb WITH OWNER = sqluser TEMPLATE template0 ENCODING = 'UTF8' TABLESPACE = pg_default LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8' CONNECTION LIMIT = -1;
Prepare the ‘sqldb’ database for Datomic:
CREATE TABLE datomic_kvs (id text NOT NULL, rev integer, map text, val bytea, CONSTRAINT pk_id PRIMARY KEY (id)) WITH (OIDS = FALSE);
ALTER TABLE datomic_kvs OWNER TO sqluser; GRANT ALL ON TABLE datomic_kvs TO sqluser; GRANT ALL ON TABLE datomic_kvs TO public;
Prepare the transactor configuration:
protocol=sql
host=localhost
port=4334
license-key=....
sql-url=jdbc:postgresql://localhost:5432/sqldb
sql-user=sqluser
sql-password=sqlpwd
sql-driver-class=org.postgresql.Driver
Start the transactor:
transactor -Xmx4g $(pwd)/transactor.properties
Create the ‘hello’ database using repl:
(require '[datomic.api :as d])
(def db-uri "datomic:sql://hello?jdbc:postgresql://localhost:5432/sqldb")
(d/create-database db-uri)
Start the console
console -p 8080 dev datomic:sql://hello?jdbc:postgresql://localhost:5432/sqldb?user=sqluser\&password=sqlpwd
Console started on port: 8080
dev = datomic:sql://hello?jdbc:postgresql://localhost:5432/sqldb
Open http://localhost:8080/browse in your browser (Chrome recommended)
Select the ‘hello’ database in the browser:
java.lang.RuntimeException: Could not find hello//hello in catalog
at datomic.peer$get_connection$fn__10699.invoke(peer.clj:681)
at datomic.peer$get_connection.invokeStatic(peer.clj:669)
at datomic.peer$get_connection.invoke(peer.clj:666)
at datomic.peer$connect_uri.invokeStatic(peer.clj:751)
at datomic.peer$connect_uri.invoke(peer.clj:743)
at clojure.lang.Var.invoke(Var.java:381)
at datomic.Peer.connect(Peer.java:106)
at datomic.api$connect.invokeStatic(api.clj:15)
at datomic.api$connect.invoke(api.clj:13)
at datomic.console$db.invokeStatic(console.clj:51)
at datomic.console$db.invoke(console.clj:49)
at datomic.console.BrowseUI$create_main_layout$db__1449.invoke(BrowseUI.clj:185)
at datomic.console.BrowseUI$create_main_layout$fn__1509.invoke(BrowseUI.clj:337)
at datomic.console.uihelp$add_vc$reify__587.valueChange(uihelp.clj:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:508)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:198)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:161)
at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:969)
at com.vaadin.ui.AbstractField.fireValueChange(AbstractField.java:1127)
at com.vaadin.ui.AbstractField.setValue(AbstractField.java:542)
at com.vaadin.ui.AbstractSelect.setValue(AbstractSelect.java:702)
at com.vaadin.ui.ComboBox.changeVariables(ComboBox.java:664)
at com.vaadin.server.communication.ServerRpcHandler.changeVariables(ServerRpcHandler.java:396)
at com.vaadin.server.communication.ServerRpcHandler.handleBurst(ServerRpcHandler.java:221)
at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:111)
at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:91)
at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:37)
at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1382)
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:238)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:835)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:583)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1158)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1090)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119)
at org.eclipse.jetty.server.Server.handle(Server.java:517)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:308)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:242)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
at java.lang.Thread.run(Thread.java:748)