# Peer server cant connect to postgresql database

**URL:** <https://forum.datomic.com/t/peer-server-cant-connect-to-postgresql-database/1120>\
**Category:** Troubleshooting\
**Created:** [August 8, 2019, 7:42am UTC](https://forum.datomic.com/t/peer-server-cant-connect-to-postgresql-database/1120 "2019-08-08T07:42:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![spoflo](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@spoflo](https://forum.datomic.com/u/spoflo)\
**Post date:** [August 8, 2019, 7:42am UTC](https://forum.datomic.com/t/peer-server-cant-connect-to-postgresql-database/1120/1 "2019-08-08T07:42:20Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jaret](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.datomic.com/jaret/32/45_2.png) [@jaret](https://forum.datomic.com/u/jaret)\
**Post date:** [August 12, 2019, 2:10pm UTC](https://forum.datomic.com/t/peer-server-cant-connect-to-postgresql-database/1120/2 "2019-08-12T14:10:26Z")

</div>

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](https://docs.datomic.com/on-prem/storage.html#sql-database)

What results do you get from `\du` in postgres?

For example:

```auto
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

---

<div class="post-metadata">

**Author:** ![spoflo](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@spoflo](https://forum.datomic.com/u/spoflo)\
**Post date:** [August 13, 2019, 7:05am UTC](https://forum.datomic.com/t/peer-server-cant-connect-to-postgresql-database/1120/3 "2019-08-13T07:05:52Z")

</div>

Hi Jaret

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

 ![image](https://us1.discourse-cdn.com/flex016/uploads/cognitect/original/1X/d3eceab9b1e7b0406b24ac40c70ec963d1b0a359.png)

looks similar to your output.

BR,  
Flo

---

<div class="post-metadata">

**Author:** ![jaret](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.datomic.com/jaret/32/45_2.png) [@jaret](https://forum.datomic.com/u/jaret)\
**Post date:** [August 13, 2019, 3:23pm UTC](https://forum.datomic.com/t/peer-server-cant-connect-to-postgresql-database/1120/4 "2019-08-13T15:23:14Z")

</div>

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:

```auto
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:

```auto
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

---

<div class="post-metadata">

**Author:** ![spoflo](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@spoflo](https://forum.datomic.com/u/spoflo)\
**Post date:** [August 13, 2019, 7:08pm UTC](https://forum.datomic.com/t/peer-server-cant-connect-to-postgresql-database/1120/5 "2019-08-13T19:08:38Z")

</div>

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