Skip to content

Instantly share code, notes, and snippets.

@yokolet
Last active December 28, 2019 15:02
Show Gist options
  • Save yokolet/8374919 to your computer and use it in GitHub Desktop.
Save yokolet/8374919 to your computer and use it in GitHub Desktop.
Datomic Pro with PostgreSQL setup

Datomic pro with Postgresql Setup

Prep

Setups

  1. Dev mode setup

Config file templates are under the directory: datomic-pro-x.x.xxxx/config/samples Use dev-transactor-template.properties and set license key in this file Start transactor from datomic-pro-x.x.xxxx directory

  bin/transactor <config filename>

Test on Java shell

  bin/shell

see: https://gist.github.com/yokolet/5584995

  1. PostgreSQL setup

2.1. Start PostgreSQL server

    pg_ctl -D /usr/local/var/postgres start

2.2. Creat user datomic with the password datomic

    createuser -d -E -P datomic

2.3. Create database

    createdb -E UTF8 -T template0 --lc-collate=en_US.UTF-8 --lc-ctype=en_US.UTF-8 -D pg_default -O datomic heh

2.4. Create table

      CREATE TABLE datomic_kvs
    (
     id text NOT NULL,
     rev integer,
     map text,
     val bytea,
     CONSTRAINT pk_id PRIMARY KEY (id )
    )
    WITH (
     OIDS=FALSE
    );
    ALTER TABLE datomic_kvs
    OWNER TO datomic;
    GRANT ALL ON TABLE datomic_kvs TO datomic;
  
  1. Transactor Property file (looks like this)

    protocol=sql
     host=localhost
     port=4334
     license-key=<license key here>
     sql-url=jdbc:postgresql://localhost:5432/heh
     sql-user=datomic
     sql-password=datomic
     sql-driver-class=org.postgresql.Driver
     
  2. Start transactor (at datomic-pro-x.x.xxxx directory)

    bin/transactor /

  3. Test on Java shell

    bin/shell

see: https://gist.github.com/yokolet/5586371

  1. Reference

http://docs.datomic.com/storage.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment