What's the difference between Daml Driver for Postgres and Daml Sandbox w/ Postgres?

If I use something like:

daml sandbox .daml/dist/example-0.0.1.dar --ledgerid daml-example-ledger --sql-backend-jdbcurl 'jdbc:postgresql://db/postgres?user=santa&password=claus'

how is that different from the DAML Driver for Postgres?

java -jar daml-on-sql-<version>.jar --ledgerid=test --sql-backend-jdbcurl='jdbc:postgresql://localhost/test?user=fred&password=secret'

Per

4 Likes

daml sandbox’s PostgreSQL backend is deprecated and provides no guarantees on being able to upgrade the schema from one SDK version to the next which makes it relatively useless as a persistence backend.

So I’d strongly recommend using the Daml Driver for PostgreSQL instead. In terms of CLI flags it should be almost identical. The main difference is that the Daml Driver for PostgreSQL does not support implicit party allocation so you have to allocate parties explicitly via the party management service before using them.

2 Likes

Thanks!

How do I supply the .dar file using the syntax above?

I’d generally recommend against supplying DAR files on the command line when using a persistent ledger. Instead, start the ledger and then upload it via the package management service, e.g., via daml ledger upload-dar.

That said, you can supply them on startup but they’ll be ignored after the first database initialization so on restarts it will just be ignored.

java -jar daml-on-sql-version.jar 
  --ledgerid l 
  --sql-backend-jdbcurl 'jdbc:postgresql://localhost:5432/ledger?user=u&password=p'
   path/to/dar
3 Likes

Many thanks!

Per

The official, supported location for the JAR is on Github releases, e.g., https://github.com/digital-asset/daml/releases/download/v1.11.1/daml-on-sql-1.11.1.jar.

The artifact on Maven central is only a thin JAR which is not supported for external usage.

Yes, found it on Release 1.11.1 · digital-asset/daml · GitHub.

Per