Recently, my client acquired an application which uses PostgreSQL database. The main application resides on IBM i. They wanted to get the data from PostgreSQL into IBM i.
I did check, if they are open to install PostgreSQL on IBM i itself, which may save them additional infrastructure costs, but the "management" was not ready and I had no power/influence on their decision.
Long story short, they asked me to confirm if we can connect in any way.
I started on the task, downloaded Scott Klement's JDBC driver Service Program. Here are the steps I took,
- Downloaded type 4 JDBC driver jar from PostgreSQL server, placed it in home folder in IFS. e.g.
/home/UserID/java/jdbc/POSTGRESQL-42.2.14.jar - Derived their Class.forName string
'org.postgresql.Driver'from their documentation. - There are few
ENVVARwhich needs to be set:- the environment variable -
CLASSPATHfor driver .jar file in IFS. - setting
STDIN,STDOUT,STDERRto catch Java exceptions, also callCHECKSTDIOprogram to set these open More details here.
- the environment variable -
RPGLEto connect and fetch the data from that server.- Compiled and tested the connection. So simple!
anandkhekale · GitHub @anand-khekale · Twitter @anandkhekale