Peer server cant connect to postgresql database

Hello everyone

I try to set up datomic (v.0.9.5951) locally on my windows 10 machine. I set up a postgresql server and created the required tables and so on by the use of the scripts provided by datomic. Then i run the transactor inside WSL which runs fine. I am able to connect, create databases and run queries against it by running the peer api in the repl.

My problem starts when i try to start up a peer-server connecting to that running transactor.

bin/run -m datomic.peer-server -h localhost -p 8998 -a myaccesskey,mysecret -d pts,datomic:sql://pts?jdbc:postgresql://localhost:5432/datomic?user=datomic&password=datomic

I get the following error message:

Exception in thread “main” java.util.concurrent.ExecutionException: org.postgresql.util.PSQLException: The server requested password-based authentication, but no password was provided.

Is there another way to provide sql user and password then to put it in the connection string? Or is there something else i do wrong?

Hi @spoflo

I know you mentioned that you created the tables from the scripts, but I want to confirm that you also created the Datomic user from the bin/sql/postgres-user.sql script?

https://docs.datomic.com/on-prem/storage.html#sql-database

What results do you get from \du in postgres?

For example:

jbin at Jarets-MacBook-Pro in ~/Desktop/Jaret/Tools/releasetest/storagetest/datomic-pro-0.9.5951
$ psql -U postgres
psql (11.4)
Type "help" for help.

postgres=# \du
                                   List of roles
 Role name |                         Attributes                         | Member of
-----------+------------------------------------------------------------+-----------
 datomic   | Create DB                                                  | {}
 jbin      | Superuser, Create role, Create DB, Replication, Bypass RLS | {}

Thanks,
Jaret

Hi Jaret

Thanks for your time. this is the result i get:

looks similar to your output.

BR,
Flo

Hi Flo,

It looks like this is a windows specific issue. From my limited testing you’ll need to escape portions of the peer-server command:

C:\Users\Administrator>echo bin/run -m datomic.peer-server -h localhost -p 8998 -a myaccesskey,mysecret -d pts,datomic:sql://pts?jdbc:postgresql://localhost:5432/datomic?user=datomic&password=datomic
bin/run -m datomic.peer-server -h localhost -p 8998 -a myaccesskey,mysecret -d pts,datomic:sql://pts?jdbc:postgresql://localhost:5432/datomic?user=datomic
'password' is not recognized as an internal or external command,
operable program or batch file.


C:\Users\Administrator>echo bin/run -m datomic.peer-server -h localhost -p 8998 -a myaccesskey,mysecret -d pts,datomic:sql://pts?jdbc:postgresql://localhost:5432/datomic?user=datomic^&password=datomic
bin/run -m datomic.peer-server -h localhost -p 8998 -a myaccesskey,mysecret -d pts,datomic:sql://pts?jdbc:postgresql://localhost:5432/datomic?user=datomic&password=datomic

You’ll note in my above example that I used echo to identify which portions of the command need to be escaped. Per this test it looks like you’ll need to escape the &. You may also be able to add quotes around the entire URI:

C:\Users\Administrator>echo bin/run -m datomic.peer-server -h localhost -p 8998 -a myaccesskey,mysecret -d pts,"datomic:sql://pts?jdbc:postgresql://localhost:5432/datomic?user=datomic^&password=datomic"
bin/run -m datomic.peer-server -h localhost -p 8998 -a myaccesskey,mysecret -d pts,"datomic:sql://pts?jdbc:postgresql://localhost:5432/datomic?user=datomic^&password=datomic"

Please let me know if you have any questions.

Thanks,
Jaret

Thanks a bunch for that echo tip. it works like a charm now!