Sandbox persistence

Hello daml community,

I am trying to set persistence to my ledger and, at the same time, run my json api.
Using DAML Driver for Postgres i can accomplish persistence:

java -jar daml-on-sql-1.17.1.jar --ledgerid=test --sql-backend-jdbcurl=“jdbc:postgresql://localhost/damltest?user=daml&password=daml”

Then i run json api:
daml json-api --ledger-host localhost --ledger-port 6865 --http-port 7575

I try to create my contracts with my Java aplication and i get this error:

HTTP 500 Internal Server Error

However, when i dont use persistence (following commands), i can create contracts, with my java aplication, and view them in navigator. RESPONSE: HTTP 200 OK

daml sandbox --wall-clock-time --ledgerid test_ledger ./.daml/dist/test-0.0.1.dar

daml json-api --ledger-host localhost --ledger-port 6865 --http-port 7575

Can you share the logs for both daml on SQL and for the JSON API?
Note also that 1.17.1 is fairly old at this point. I recommend switch to 2.1 although your setup should work on 1.17 as wlel.


POSTGRES


JSON API ERROR

Command: daml start

JSON API RESPONDING 200 OK

Ok i did it, i used this commands, now i can store my ledger in postgres while running json api:

daml deploy --host localhost --port 6865

daml json-api --ledger-host localhost --ledger-port 6865 --http-port 7575 --allow-insecure-tokens

java -jar daml-on-sql-1.17.1.jar --ledgerid=test_ledger --sql-backend-jdbcurl=“jdbc:postgresql://localhost/test2?user=test2&password=test2”

daml navigator server --port 7500

1 Like

Ah right that’s expected, you need to upload the package first. I believe if you look at the full error returned by the JSON API it should tell you that it couldn’t find the template or something along those lines.

1 Like