MySQL or Postgres Storage for Datomic
In responding to a recent Stack Overflow question, I ran into a few hitches getting MySQL and PostgreSQL working as backend storages. As a reference, I followed this section of the documentation, to setup MySQL and PostgreSQL storage.
These snippits assume that you have Postgres and MySQL installed and that you are operating from the Datomic root directory on your local machine.
Setup the SQL database (create the table and users)
Postgres:
MySQL:
Start the transactor
Command:
Postgres properties file:
MySQL properties file:
With the addition of the Client library in 0.9.5530 you can start a peer server to serve access to databases for the client library. If you’re going to do so on SQL storage you’ll need to ensure the database is created before standing up the peer-server. To do so, launch a peer against the transactor (in this case, I executed bin/repl from the Datomic root directory) and run the following:
MySQL:
Postgres
Now that you have your database created you can pass in the “test” db name to the peer server connection string:
Please note that when launching your peer-server, you’ll need to ensure you have the proper credentials (username and password) as configured in MySQL or PostgreSQL.
Let me know if you have any questions on setting up MySQL or PostgreSQL as your underlying storage for Datomic.
Cheers,
Jaret