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:
- From IBM, https://www.ibm.com/support/pages/db2-jdbc-driver-versions-and-downloads
- Open Source version, http://jt400.sourceforge.net/
JDBC String,
jdbc:db2://myhost:50000/sample
Optional-Static IP setting in Ubuntu 18
$ sudo vi /etc/netplan/50-cloud-init.yamlafter editing it appropriately,
$ sudo netplan apply
References
- https://www.ibm.com/support/knowledgecenter/en/SSEPGG_10.1.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0001939.html
- https://geekup.zone/2018/10/09/install-db2-express-c-on-linux/
- https://www.ibm.com/support/knowledgecenter/en/SS6NHC/com.ibm.swg.im.dashdb.doc/connecting/connect_connecting_jdbc_applications.html
- https://www.ostechnix.com/how-to-configure-ip-address-in-ubuntu-18-04-lts/
No comments:
Post a Comment