Maksim Ryzhikov

The first step is create a project directory

mkdir /tmp/foo

Add deps.edn file with jdbc and PostgreSQL dependencies. jdbc — is a universal Java interface for connection to databases.

{:deps {org.clojure/java.jdbc {:mvn/version "0.7.12"}
org.postgresql/postgresql {:mvn/version "42.3.3"}}}

The second step is creating a main file src/main.clj

(ns main
(:require
[clojure.java.jdbc :as j]))
(def pg-db {:dbtype "postgresql"
:port 5432
:user "admin"
:dbname "admin"
:password "admin"})
(j/query pg-db ["SELECT current_database()"])

The third step — run PostgreSQL. We’ll use docker for this purpose.

docker run -v $(pwd)/pgdata:/var/lib/postgresql/data -p 5432:5432 --name pg -e POSTGRES_USER=admin -e POSTGRES_PASSWORD=admin postgres

Now we can run REPL and check that all works!

--

--

We can download required version of GraalVM using curl

curl --create-dirs --output-dir ~/Library/Java/JavaVirtualMachines -OL https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/graalvm-ce-java17-darwin-amd64-22.0.0.2.tar.gz

This command will download graalvm-ce-java17-darwin-adm64-22.0.0.2.tar.gz to ~/Library/Java/JavaVirtualMachines. Now we should extract archive’s content by tar

tar xvzf graalvm-ce-java17-darwin-amd64-22.0.0.2.tar.gz

Now we can add GRAALVM_HOME environment variables to .bashrc or .zshrc

export GRAALVM_HOME="$HOME/Library/Java/JavaVirtualMachines/graalvm-ce-java17-22.0.0.2/Contents/Home"

also, we can add GraalVM bin folder to the PATH . This allows us to easily access executable commands from shell

export PATH="$GRAALVM_HOME/bin:$PATH"

Now we can easily install native-image using gu command

gu install native-image

--

--

After 10 years being programmers I see two different minds — “vim” mind and “apple” mind.

“Vim “ mind — is an example of open source mind. Free product, developed by community. With vim you get bare minimum and after that you start to sharp it for you. You can…

--

--