With Datomic, I am confused as to how to get a local database to play around with
If I type:
>>(ns datomic-tut (:use [datomic.api :as d]))
nil
>>(d/create-database "datomic:mem://hello")
true
>> (d/connect "datomic:mem://hello")
#<LocalConnection datomic.peer.LocalConnection@57102fab>
>> Ctrl-D to Disconnect
Then, if I restart the repl:
>> (ns project-ns (:use [datomic.api :as d]))
nil
>> (d/connect "datomic:mem://hello")
ExceptionInfo :peer/db-not-found Could not find hello in catalog clojure.core/ex-info (core.clj:4227)
Is there another type of local uri I can create that saves the database that I create?
The getting started guide talks about using free storage protocol
Running the transactor with the free storage protocol
The free storage protocol uses local disk files for storage.
You can start a local transactor with free storage as follows:
bin/transactor config/samples/free-transactor-template.properties
This script will print a few lines of output, including the base URI you will use to connect, e.g.
datomic:free://localhost:4334/<DB-NAME>
To create a connection string, simply replace with a database name of your choice, e.g. "hello":
datomic:free://localhost:4334/hello
Using this URI, you should now be able to repeat the steps from the previous section, this time making your connection to the transactor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With