Wednesday, 16 December 2020

Connecting to IBM Db2 from SQuirreLSQL on macOS

This came up in a thread from an IBM colleague, and led me to have a tinker with a new-to-me tool, SQuirreLSQL 

Having downloaded and installed the app, making sure to select the IBM Db2 driver: -


and having spun up a Db2 container on one of my Docker boxes: -

docker run -itd --name mydb2 --privileged=true -p 50000:50000 -e LICENSE=accept -e DB2INST1_PASSWORD=p4ssw0rd -e DBNAME=testdb -v ~/db2:/database ibmcom/db2 

( this is a useful inspiration for Db2 on Docker )

I realised that I also needed to download an IBM Db2 JDBC driver from: -


which resulted in: -

-rw-r--r--@   1 hayd  staff  8341739 16 Dec 10:46 v11.5.5_jdbc_sqlj.tar.gz

I unpacked this: -

tar xvzf ~/Downloads/v11.5.5_jdbc_sqlj.tar.gz -C /tmp

x jdbc_sqlj/
x jdbc_sqlj/license/
x jdbc_sqlj/license/UNIX/
x jdbc_sqlj/license/UNIX/jdbc4_LI_fr
x jdbc_sqlj/license/UNIX/jdbc4_LI_cs
x jdbc_sqlj/license/UNIX/jdbc4_LI_pl
x jdbc_sqlj/license/UNIX/jdbc4_LI_tr
x jdbc_sqlj/license/UNIX/jdbc4_LI_de
x jdbc_sqlj/license/UNIX/jdbc4_LI_zh_TW
x jdbc_sqlj/license/UNIX/jdbc4_LI_in
x jdbc_sqlj/license/UNIX/jdbc4_LI_es
x jdbc_sqlj/license/UNIX/jdbc4_LI_ja
x jdbc_sqlj/license/UNIX/jdbc4_LI_zh
x jdbc_sqlj/license/UNIX/jdbc4_LI_it
x jdbc_sqlj/license/UNIX/jdbc4_LI_pt
x jdbc_sqlj/license/UNIX/jdbc4_LI_en
x jdbc_sqlj/license/UNIX/jdbc4_LI_ko
x jdbc_sqlj/license/Windows/
x jdbc_sqlj/license/Windows/jdbc4_LI_tw.rtf
x jdbc_sqlj/license/Windows/jdbc4_LI_tr.rtf
x jdbc_sqlj/license/Windows/jdbc4_LI_kr.rtf
x jdbc_sqlj/license/Windows/jdbc4_LI_pl.rtf
x jdbc_sqlj/license/Windows/jdbc4_LI_cz.rtf
x jdbc_sqlj/license/Windows/jdbc4_LI_it.rtf
x jdbc_sqlj/license/Windows/jdbc4_LI_br.rtf
x jdbc_sqlj/license/Windows/jdbc4_LI_en.rtf
x jdbc_sqlj/license/Windows/jdbc4_LI_es.rtf
x jdbc_sqlj/license/Windows/jdbc4_LI_cn.rtf
x jdbc_sqlj/license/Windows/jdbc4_LI_fr.rtf
x jdbc_sqlj/license/Windows/jdbc4_LI_de.rtf
x jdbc_sqlj/license/Windows/jdbc4_LI_jp.rtf
x jdbc_sqlj/license/Windows/jdbc4_LI_in.rtf
x jdbc_sqlj/license/jdbc4_notices.txt
x jdbc_sqlj/license/jdbc4_notices.rtf
x jdbc_sqlj/db2_db2driver_for_jdbc_sqlj.zip

unzip /tmp/jdbc_sqlj/db2_db2driver_for_jdbc_sqlj.zip -d /tmp

Archive:  /tmp/jdbc_sqlj/db2_db2driver_for_jdbc_sqlj.zip
  inflating: /tmp/db2jcc4.jar        
  inflating: /tmp/jdbc4_LI_br.rtf    
  inflating: /tmp/jdbc4_LI_cn.rtf    
  inflating: /tmp/jdbc4_LI_cs        
  inflating: /tmp/jdbc4_LI_cz.rtf    
  inflating: /tmp/jdbc4_LI_de        
  inflating: /tmp/jdbc4_LI_de.rtf    
  inflating: /tmp/jdbc4_LI_en        
  inflating: /tmp/jdbc4_LI_en.rtf    
  inflating: /tmp/jdbc4_LI_es        
  inflating: /tmp/jdbc4_LI_es.rtf    
  inflating: /tmp/jdbc4_LI_fr        
  inflating: /tmp/jdbc4_LI_fr.rtf    
  inflating: /tmp/jdbc4_LI_it        
  inflating: /tmp/jdbc4_LI_it.rtf    
  inflating: /tmp/jdbc4_LI_ja        
  inflating: /tmp/jdbc4_LI_jp.rtf    
  inflating: /tmp/jdbc4_LI_ko        
  inflating: /tmp/jdbc4_LI_kr.rtf    
  inflating: /tmp/jdbc4_LI_pl        
  inflating: /tmp/jdbc4_LI_pl.rtf    
  inflating: /tmp/jdbc4_LI_pt        
  inflating: /tmp/jdbc4_LI_tr        
  inflating: /tmp/jdbc4_LI_tr.rtf    
  inflating: /tmp/jdbc4_LI_tw.rtf    
  inflating: /tmp/jdbc4_LI_zh        
  inflating: /tmp/jdbc4_LI_zh_TW     
  inflating: /tmp/jdbc4_REDIST.txt   
  inflating: /tmp/sqlj4.zip          

and then added a new JDBC driver to the SQuirreLSQL client: -



and connect to my Db2 on Docker instance: -


and query my database: -


Nice!

No comments:

Reminder - installing podman and skopeo on Ubuntu 22.04

This follows on from: - Lest I forget - how to install pip on Ubuntu I had reason to install podman  and skopeo  on an Ubuntu box: - lsb_rel...