I’m new to DAML, and trying to integrate PostgreSQL server.
When, I try execute below command, “The API server was unable to bind to port 6865. Terminate the process occupying the port, or choose a different one.” exception is thrown.
java -jar daml-on-sql-1.18.2.jar --ledgerid=test --sql-backend-jdbcurl="jdbc:postgresql://mydbserver.com:5432/test_db?user=test_db_user&password=userPass123¤tSchema=public"
I understand that, canton sandbox is already running on port 6865. How could I configure this command to run on different port and still interact with my DAML project running on port 6865.
DAML SDK : 2.1.1
DAML on SQL : 1.18.2
There should be something along the lines of a
--port CLI option, although I don’t remember exactly the name. Can you have a look if
java -jar daml-on-sql-1.18.2.jar --help (documented here) gives you some meaningful pointer?
It is indeed
-p also works:
Daml-on-SQL version 1.18.2
Usage: daml-on-sql [options] [<archive>...]
<archive>... Daml archives to load in .dar format. Only Daml-LF v1 Archives are currently supported. Can be mixed in with optional arguments.
-a, --address <value> Service host. Defaults to binding on localhost.
-p, --port <value> Service port. Defaults to 6865.
Thanks for the quick responses @stefanobaghino-da & @Gary_Verhaegen !!
One more question though, how do I configure my DAML project to connect to the specified ledger-id on the new port
--ledgerid as you used above, like so
java -jar daml-on-sql-1.18.2.jar --port <your_port_number> --ledgerid=test --sql-backend-jdbcurl="jdbc:postgresql://mydbserver.com:5432/test_db?user=test_db_user&password=userPass123¤tSchema=public"
Since you are using SDK 2.1.1, I recommend that you move away from Daml-on-SQL, to a Canton setup with Postgres as backend, as soon as possible. Daml-on-SQL is no longer supported. See this previous thread: