Help troubleshooting: creating a database with a PostgreSQL connection

#1

Hello!

New Datomic user here. I’ve followed the Storage services guide to set up a PostgreSQL backend for my transactor, and then the Local Dev Setup. My goal is to be able to create a database from the provided bin/repl, which is where I run into trouble.

Everything is running on once machine. PostgreSQL, the transactor, and the REPL.

Here’s what I’m doing:

  1. Ensure that PostgreSQL is running and that I can connect with the user / pass / db name (as specified in the config file below)
  2. Start bin/transactor config/pgsql-transactor.properties in one shell
  3. In a bin/repl shell, run
user=> (def uri "datomic:sql://test-db?jdbc:postgresql://localhost:5432/datomic?user=datomic&password=datomic")
user=> (require '[datomic.api :as d])
user=> (d/create-database uri)

which results in

IllegalArgumentExceptionInfo :db.error/read-transactor-location-failed Could not read transactor location from storage  datomic.error/arg (error.clj:57)

… and I’m not really sure where to look next.

  • Does the connect URI look right?
  • Anything funky in the transactor config? (excerpt below)
  • Are the warnings I get when starting the transactor normal? (below)

Thanks in advance!

Teodor


Config file excerpt
protocol=sql
host=localhost
port=4334

license-key=...

sql-url=jdbc:postgresql://localhost:5432/datomic
sql-user=datomic
sql-password=datomic
Transactor startup warnings
$ bin/transactor config/pgsql-transactorroperties 
Launching with Java options -server -Xms1g -Xmx1g -XX:+UseG1GC -XX:MaxGCPauseMillis=50
Starting datomic:sql://<DB-NAME>?jdbc:postgresql://localhost:5432/datomic?user=datomic&password=datomic, you may need to change the user and password parameters to work with your jdbc driver ...
System started datomic:sql://<DB-NAME>?jdbc:postgresql://localhost:5432/datomic?user=datomic&password=datomic, you may need to change the user and password parameters to work with your jdbc driver
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.PlatformDependent0 (file:/home/teodorlu/opt/datomic-pro-0.9.5786/lib/netty-all-4.0.39.Final.jar) to field java.nio.Buffer.address
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.PlatformDependent0
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
#2

The Could not read transactor location from storage error indicates that your peer is not able to read the storage location.
It looks to me like you have a URL-escaped ascii symbol in your URI: &amp;
Try:

user=> (def uri "datomic:sql://test-db?jdbc:postgresql://localhost:5432/datomic?user=datomic&password=datomic")
1 Like
#3

Hello Marshall,

Thanks for the comment! You really got me unstuck. After I fixed the ampersand as per your suggestion, I got another error:

ActiveMQNotConnectedException AMQ119007: Cannot connect to server(s). Tried with all available servers. org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory (ServerLocatorImpl.java:799)

I tried again with a datomic:dev db, and got the same error. Which was strange! I proceeded to re-read the installation instructions, and noticed that I was trying to run Datomic on a Java 11 system. Installed Java 8, and no more errors.

Thanks again! I’m connected, and everything is running smooth.

Teodor