Specifying DB-Name


#1

From the docs:

This script will print a few lines of output, including the base URI you will use to connect, e.g.

datomic:dev://localhost:4334/<DB-NAME>

To create a connection string, simply replace <DB-NAME> with a database name of your choice, e.g. “hello”:

datomic:dev://localhost:4334/hello

But DB-NAME appears on the printout so you can’t replace THAT string. In the transactor properties file, there are entries for protocol, port and host, but nothing resembling db-name.

(I know I’ve figured this out before but it’s tripped me up twice, so I’m suggesting a document edit.)


#2

The output from running the transactor (i.e. datomic:dev://localhost:4334/<DB-NAME>) is the template/format of the database URI.

A URI for a given database would replace <DB-NAME> with your desired database name (i.e. datomic:dev://localhost:4334/hello).

A single transactor can serve multiple databases in the same storage, hence there is no specific database name in the properties file. You run the transactor against storage then create or connect to individual databases from a peer (see https://docs.datomic.com/on-prem/getting-started/connect-to-a-database.html#repl).


#3

Thanks, Marshall—

Okay, I see what you’re saying. My issue is that it’s NOT connecting…but I see now it’s because I had “datomicdb” in place of “localhost”.

I also see where I got this from. I’m looking at some code where the URIs are specified as:

(case (env :datomic-storage)
       "sql" "datomic:sql://%s?jdbc:mysql...."
       "mem" "datomic:mem://%s"
       "datomic:dev://datomicdb:4334/%s")

Is this a HOSTS thing?


#4

I’m not sure where this is from, but it appears to be a dispatch to allow you to use any one of multiple storage options (i.e. a sql store, a mem store, the dev store, etc).


#5

Oh, it’s code I inherited, sorry. But something must be substituting “localhost” (or 127.0.0.1, I suppose) for “datomicdb” on that last line in order for it to work, I think. I tried adding adding datomicdb to /etc/hosts with no luck, but I’ll work it out.