In this article we will review the installation of 3 different SQL clients.
After that, you can choose the one that best fits your need :)
All the SQL clients which will be reviewed are java applications. So the first step is to install Java on Haiku - if not yet available.
Under Haiku Depot, type "jdk17" and select the openjdk17 in the "All packages" tab :
Proceed with the installation.
In case you don't have a PostgreSQL database created on your system, follow the article "Install PostgreSQL" in order to have a sample database to work with.
The first SQL client we will review is Squirrel SQL.
The official website is https://squirrel-sql.sourceforge.io/
Download the zip archive which includes optional items at https://sourceforge.net/projects/squirrel-sql/files/1-stable/4.8.0-plainzip/squirrelsql-4.8.0-optional.zip/download
Unzip the file in a dedicated folder like "/boot/home/config/non-packages/apps" :
If you want to download the latest JDBC driver for PostgreSQL, go to the URL https://jdbc.postgresql.org/ and proceed with the download.
Select the file corresponding to java 8. The current latest version is named "postgresql-42.7.4.jar". Put this file in a new folder named "jdbc" inside the Squirrel directory :
Now let's make the shell -which is launching Squirrel- executable:
chmod +x ./squirrel-sql.sh
And run the program :
./squirrel-sql.sh
You will see the main window below :
The current version is 4.8.0 :
Before using it with PostgreSQL, you need to define where the JDBC driver is located.
In the Drivers tab, select the PostgreSQL line :
Right click and select "Modify Driver" :
You need to indicate the JDBC driver location. Click on the Add button :
Then select the corresponding "jar" file :
Now go into the Aliases tab :
Click on Create a new Alias :
Indicate :
Click on the "Test" button and then "Connect" :
if the connection is fine, you will see the below message :
Now select your "HaikuDB" alias :
Then right-click and select "Connect" :
In the Objects tabs, a hierarchical objects view is available :
Select the public schema and then the contact table :
You will then see all the information relative to this table :
if you click on the Content tab, it will list all the existing records :
Another way to access the data in the database, is to use a SQL query.
In the SQL tab, type :
select * from contact
Then click on the Run SQL icon :
As you can see, the Results tab will list all the records as well :)
Please note the additional part for Squirrel SQL includes the plugins part, meaning :
This is true for others database providers (mysql, sybase, ...) :
You can replace the PostgreSQL driver we have downloaded at the beginning of this article (version 42.7.4) but this one, but it's an older version (ie 42.2.9).
The second SQL client is named SQL Workbench J.
You can access the official website at https://www.sql-workbench.eu/
Download the latest release corresponding to the "generic package for all systems including all optional libraries" on this website. Unzip the archive in a dedicated directory :
The content should be like below :
Let's go into that folder and make the launching script executable :
chmod +x ./sqlworkbench.sh
Now launch the program :
./sqlworkbench.sh
The latest version is as of May 2024.
In the main window, let's setup the driver with the "File>Manage drivers" menu :
Select the PostgreSQL entry. In the Library area, click on the folder icon :
And indicate where the JDBC driver for PostgreSQL is located :
On my machine, like Squirrel SQL, I have created a dedicated directory "jdbc" where I have copied the driver file downloaded at the beginning of this article.
The driver should now be fine, validate with "Ok" :
Now let's setup a new connection. Select the "File> Connect Window" menu :
Then indicate :
Confirm with "Ok".
The connection should be effective. The below Database explorer will display the objects, like the "contact" table :
Let's query the database content. In the Statement tab, type :
select * from contact
And click on the Execute icon. The below records will be displayed as expected :
You are now mastering two SQL clients under Haiku:)
The last SQL client is DB Visualizer. DB Visualizer is a professional product, however there's a free version with limited features.
The official website is https://www.dbvis.com/
Go to the download and select the Linux version without java :
Extract the archive in a dedicated directory :
Let's make the launch script executable :
chmod +x ./dbvisgui.sh
Then launch it :
./dbvisgui.sh
Mmm, java 21 is the minimum version expected.
We will cheat a little bit because only OpenJDK 17 is available on Haiku. Let's modify the script :
lpe ./dbvisgui.sh &
First remove the if statement in yellow below :
Then remove the else paragraph :
Finally remove the "if" line in yellow below, and the "fi" line at the end :
The checks regarding the java version are now disable.
Please consider DB Visualizer as an unofficial version due to that trick :)
Let's launch the program again :
./dbvisgui.sh
Great it's now working !
Select the "DBVisualizer Free" :
The main window below is displayed :
The current version of DBVisualizer Free is 24.3.2, and yes we are under Haiku !
In the Tools menu, select "Driver Manager" :
In the Databases area, right-click and select "Create Database Connection> Create Database Connection from Database URL" :
Type your database URL and after that select "PostgreSQL" driver just below :
The database URL should be something like "jdbc://localhost:5432/haikudb".
Click on OK.
Then in the main screen indicate :
When typing the password, you might encounter the below error :
Ignore it with close window.
In the Settings Format select "Server Info", and click on the "Ping Server" button.
You should see the below successful message (which is strange because the password was not entered entirely):
Let's connect to the database :
Connection is now ok !
You can browse your databases now. Select the "haikudb" database and then the "public" schema which contains the "contact" table :
Select the SQL commander tab with the "haikudb" database and type :
select * from contact
Run the query with the Execute icon.
You will see the below existing records :
Maybe you will notice the "Create table" feature in DBVisualizer :
The menu is available but this option is only available in the pro version :)
I hope you have find this article useful.
You should now be able to connect to any database under Haiku with one of these SQL clients.
The current working databases under Haiku are PostgreSQL and SQLite. So these SQL clients can be used under Haiku to facilitate the access to these kind of databases.