February 4, 2020

[NOTE] Install DB2 (Express-C) on Ubuntu 18


This is for:
VirtualBox on Win10 + Ubuntu 18 + DB2 express-C 64-bit.


Headless setting takes too much effort, thus installed on Ubuntu 18 with GUI.


1. Download for Linux

Register IBM ID when you download the file.

(1) First go here,
https://www.ibm.com/support/knowledgecenter/en/SSEPGG_9.7.0/com.ibm.db2.luw.qb.server.doc/doc/r0054460.html

(2) Search for "express-c"https://www.ibm.com/search?lang=en&cc=us&q=express-c
And click on DB2 Express-C database server

(Or try this link, https://www-01.ibm.com/marketing/iwm/iwm/web/pickUrxNew.do?source=swg-db2expressc&mhsrc=ibmsearch_a&mhq=express-c)

I downloaded 64 bit, v11.1.  File name is v11.1_linuxx64_expc.tar.gz

2. Install

(1) Uncompress that file

$ tar zxvf v11.1_linuxx64_expc.tar.gz

(2) set up

$ cd expc

Check if all required dependencies are installed.  If not, install them.
$ ./db2prereqcheck

Then run installer
$ ./db2_install

Takes a while, and will install at ~/sqllib

3. Set up, Start

Start DB2:

$ db2start

And need to set up a couple of things.  Run client:

$ db2

3.1. Create sample database:

db2 => create database sample
DB20000I  The CREATE DATABASE command completed successfully.

3.2. Set up port 50000:
 
db2 => UPDATE DBM CFG USING SVCENAME 50000
DB20000I  The UPDATE DATABASE MANAGER CONFIGURATION command completed
successfully.
SQL1362W  One or more of the parameters submitted for immediate modification
were not changed dynamically. Client changes will not be effective until the
next time the application is started or the TERMINATE command has been issued.
Server changes will not be effective until the next DB2START command.

3.3. Then set up TCP/IP

$ db2 get dbm cfg | grep SVCENAME
TCP/IP Service name                          (SVCENAME) =
SSL service name                         (SSL_SVCENAME) =

$ db2set DB2COMM=tcpip
$ db2set -all
[i] DB2COMM=TCPIP
[g] DB2_COMPATIBILITY_VECTOR=MYS


To stop and start again and test

$ db2stop
SQL1064N  DB2STOP processing was successful.

$ db2start

$ db2 connect to sample user kkim using <password>
Other helpful commands, for diagnostic output:

$ db2diag

4. JDBC

Make sure the port is defined in /etc/services file, if not add the line:
# vi /etc/services

Append this,

db2c_db2inst1   50000/tcp               # db2


Get driver from one of these sites:
I got one from IBM.  Uncompress the downloaded file (v11.1.4fp4a_jdbc_sqlj.tar.gz), and use these JARs: db2jcc.jar, db2jcc4.jar

JDBC String,
jdbc:db2://myhost:50000/sample


Optional-Static IP setting in Ubuntu 18

$ sudo vi /etc/netplan/50-cloud-init.yaml

after editing it appropriately,

$ sudo  netplan apply



References


DB GUI clients

 

No comments: