DbSchema for Db2 Database

DbSchema is a powerful database management and design tool for Db2. It offers features such as visual schema design, team collaboration with GIT, schema deployment and HTML schema documentation.

How to Connect to Db2 Database

  1. Access the Connection Dialog

    Choose "Connect to the database" or "New Model Connected to the Database" will let you select your database and open the Connection Dialog.

    DbSchema automatically downloads the JDBC driver to connect to your database.

  2. Configure the Connection
  3. In the Connection Dialog window, select the JDBC URL you want to connect with. If your database is running in the cloud, choose Edit Manually and insert the JDBC URL from the cloud console.

    Enter the host name, the authentication details, select your database as described in the Connection Dialog page.

  4. Troubleshoot Firewall Issues
  5. If you encounter connection issues, it may be due to firewall settings. Read how to enable Firewall Connections.
Remember to enable Windows Firewalls Firewalls & anti-viruses may block database connections.

DbSchema includes Db2 drivers. The driver requires two files, db2jcc.jar and db2jcc_license_cu.jar.

There is an open source JDBC driver available for AS400 / iSeries called jtopen. See http://jt400.sourceforge.net/

Run Db2 in Docker Container

There is a Db2 docker container available at https://hub.docker.com/r/ibmcom/db2.

Create the container using:

docker run -itd --name db2 --privileged=true -p 50000:50000 -e LICENSE=accept -e DB2INST1_PASSWORD=DbSchema12 -e DBNAME=test ibmcom/db2
From DbSchema you can connect using
  • User: db2inst1
  • Password: DSchema12
  • Database: test

Install Db2 Express Edition

Db2 Express can be downloaded from https://www.ibm.com/developerworks/downloads/im/db2express/ After install you can connect using the user db2admin and the set password

Start the Db2 Command Line Window and execute the command

db2 list db directory
In Db2 Command Line Processor you can issue 'connect to sample' to connect to this database.

How to list Db2 running instances

Create New Database

From the Command Line Processor create a database using the command 'Create database test;''

How to create new database in DB2

Create new database in DB2

Connect from DbSchema using the user db2admin with password you defined during installation, and database test.

DbSchema Connection Dialog

Short Tutorial on Installing Db2 On Windows

Download Db2 Express from www.ibm.com/software/data/db2/express/

During the installation you have to enter the password for the database user db2admin

How to install Db2 database

Choose the DB2 instance. This means you can run the DB2 software more than one time on a single computer. This parameter is not required in DbSchema.

Choose the DB2 instance

Short Tutorial on Installing Db2 On Linux Ubuntu

We have the experience of installing Db2 on Ubuntu 10.6, and we want to share this experience with you.

  • Install Java on Ubuntu using
    • In packadge manager enable third party software
    • sudo apt-get update
    • sudo apt-get install sun-java6-jdk
  • See snippets.dzone.com/posts/show/3682
  • sudo apt-get libstdc++5
  • sudo apt-get libaio1
  • Download db2 software. Unpack and execute as root './db2_install'. Install in a different location: /opt/db2
  • Create three users as follow, with a home directory ( -m ) and with a group for them ( -U ). Change their password and be sure this users have a .profile file inside:
    useradd -m -U -s /bin/bash db2inst1
    useradd -m -U -s /bin/bash db2fenc1
    useradd -m -U -s /bin/bash dasusr1
    passwd db2inst1
    passwd db2fenc1
    passwd dasusr1
          
  • Create an instance and an administration server:
    cd /opt/db2/instance
    ./db2icrt -p 50000 -u db2fenc1 db2inst1
    ./db2dascrt -u dasuser1
          
  • Add the following lines to /etc/services:
    DB2_TMINST 50000/tcp
          
  • Login as db2inst1 and execute
    db2 update dbm cfg using svcename 50000
    db2set DB2COMM=tcpip
          
  • Start the database
    db2start
          

Install Ubuntu utilities

  • Download TeamViewer debian packadge, execute:
    ln -s /opt/teamviewer/teamviewer/6/bin/teamviewer /etc/init.d/TeamViewer
    update-rc.d noip defaults
      
  • Download noip, execute:
    binaries/noip2-i686 -C
    ln -s /opt/noip-2.1.9-1/debian.noip2.sh /opt/init.d/noip
    update-rc.d noip defaults