Interact with a Postgresql database with Ballerina!

Manuri Amaya Perera
Ballerina Swan Lake Tech Blog
1 min readAug 12, 2018

We are going to try out a simple example of interacting with a postgresql database with Ballerina programming language.

  1. First you need to have postgresql installed.
  2. Also download and install Ballerina 0.981.0
  3. Download the postgresql driver (I used the version 42.2.1)

Now connect to your postgresql server and create a database called “customerdb”. That is the one we are going to connect through our Ballerina program.

Here goes the Ballerina program. We are simply creating a table using the Ballerina jdbc client, then insert a record to the table and retrieve the data from that table and iterate!

--

--

Manuri Amaya Perera
Ballerina Swan Lake Tech Blog

I am an Engineer at WSO2. Currently working in the Ballerina team. Mainly contributing to Ballerina data client area. My GitHub URL: https://github.com/manuri