Topic
20 replies Latest Post - ‏2015-03-21T21:23:04Z by prl99
LeoPetraz
LeoPetraz
226 Posts
ACCEPTED ANSWER

Pinned topic DB2 Express-C 10.1 for Mac OS X installation guide

‏2013-01-10T21:37:53Z |

DB2 Express-C installation guide for Mac OS X

Prerequisites

  • Mac OS X Mountain Lion or newer
  • XCode developer tools must be installed. These can be installed from the Mac App Store.


Configure Mac OS for DB2

The following kernel settings must be set and the computer restarted before installing DB2.

Ensure the following entries are in the /etc/sysctl.conf. Create the file /etc/sysctl.conf if it does not exist.


kern.sysv.shmmax=1073741824
kern.sysv.shmmin=1
kern.sysv.shmmni=4096
kern.sysv.shmseg=32
kern.sysv.shmall=1179648
kern.maxfilesperproc=65536
kern.maxfiles=65536

Restart your Mac after creating the file to make the values take effect.


Open up the Terminal.

Change to root:

sudo su -

Ensure that otool is in the path. Execute otool:


otool


If the error is "command not found" then run the following


export PATH=$PATH:/Applications/XCode.app/Contents/Developer/usr/bin


Extract the .tar.gz archive:


tar -xvf <imagename>


Go into the expc directory and run the installer.


cd expc 
sudo ./db2_install


Specify the installation directory when asked:


/opt/IBM/db2/V10.1


It is recommended that you use the default.

After the installation is complete, go into instance/ subdirectory of the directory above. If using the defaults, this will be:


/opt/IBM/db2/V10.1/instance


Create a DB2 instance by executing:


./db2icrt -u <instance owner> <instance owner>


The instance owner can be any non-root user. Edit: It is recommend that you create a new user (e.g. db2inst1) in your Mac System Preferences for this.

DB2 software is now installed and an instance is configured.

Start DB2 Server

Open up the Terminal.

Become the DB2 instance owner user:

su - db2inst1

Initialize the environment for DB2:


cd $HOME/sqllib 
.   ./db2profile


Start DB2:


db2start

Network access

If you need to access this DB2 instance remotely, you should configure the service:

db2 update dbm cfg using svcename db2c_db2inst1

sudo su -

echo 'db2c_db2inst1 50000/tcp' >> /etc/services

exit

db2set -all
db2set DB2COMM=TCPIP
db2stop force
db2start

DB2 tips

Create a database:

db2 create database yfs on /Users/db2inst1/db2

Find your JDBC driver (db2jcc.jar):

cd /opt/IBM/db2/V10.1/java

open .

Updated on 2014-01-21T20:58:54Z at 2014-01-21T20:58:54Z by LeoPetraz
  • SystemAdmin
    SystemAdmin
    5837 Posts
    ACCEPTED ANSWER

    Re: DB2 Express-C 10.1 for Mac OS X installation guide

    ‏2013-01-13T11:18:32Z  in response to LeoPetraz
    There is a Typo!

    export PATH=$PATH_:_/Applications/XCode.app/Contents/Developer/usr/bin
  • SystemAdmin
    SystemAdmin
    5837 Posts
    ACCEPTED ANSWER

    Re: DB2 Express-C 10.1 for Mac OS X installation guide

    ‏2013-01-13T11:20:24Z  in response to LeoPetraz
    There is a Typo!

    export PATH=$PATH*:*/Applications/XCode.app/Contents/Developer/usr/bin
  • SystemAdmin
    SystemAdmin
    5837 Posts
    ACCEPTED ANSWER

    Re: DB2 Express-C 10.1 for Mac OS X installation guide

    ‏2013-01-13T20:03:39Z  in response to LeoPetraz
    I had to do two additional steps to get the database to communicate with my application. 1. Update the service name and then tell db2 to use TCPIP

    This might be because I created a seperate user account on my machine to run db2. (db2inst1)

    Using db2inst1 user account I typed the following:

    db2 update dbm cfg using svcename db2c_db2inst1

    Then under my admin ID for my Mac I did:

    sudo vim /etc/services
    I then added the following to the bottom of the file and saved it.
    db2c_db2inst1 50000/tcp
    Then under the db2inst1 account I typed:

    db2set DB2COMM=TCPIP

    Finally I did
    db2stop
    db2start
    I can not connect from my java application to db2
    • c.kuhroeber
      c.kuhroeber
      7 Posts
      ACCEPTED ANSWER

      Re: DB2 Express-C 10.1 for Mac OS X installation guide

      ‏2014-01-07T10:12:12Z  in response to SystemAdmin

      Hi,

       

      well, you wrote, that you can't connect do DB2 with your Java application ... Same for me here, too.

      Did you already find a solution for that (I know, that this thread is already a couple of months old, but I just came to get my MacBook and I'm doing my first steps).

      I can connect to my DB2 10.1 with db2 command line tool but I can't use for instance the Database Explorer that is shipped with (My)Eclipse - which a Java application. Also - after setting the Oracle Compatibility - I cannot connect with clpplus (which in turn uses Java as well).

       

      Best regards and thx in advance ;-)

      Christian

  • SystemAdmin
    SystemAdmin
    5837 Posts
    ACCEPTED ANSWER

    Re: DB2 Express-C 10.1 for Mac OS X installation guide

    ‏2013-01-25T04:29:42Z  in response to LeoPetraz
    saya sudah mengikuti nya semua langkah tetapi masih belum bisa ya? ketika saya masuk untuk perintah ./db2setup nya terima kasih
    • LeoPetraz
      LeoPetraz
      226 Posts
      ACCEPTED ANSWER

      Re: DB2 Express-C 10.1 for Mac OS X installation guide

      ‏2013-01-25T19:44:25Z  in response to SystemAdmin
      Sila hantar sebarang mesej ralat yang anda lihat. Adalah sukar untuk membantu tanpa mengetahui butiran lanjut.

      Regards,

      Leons
      • SystemAdmin
        SystemAdmin
        5837 Posts
        ACCEPTED ANSWER

        Re: DB2 Express-C 10.1 for Mac OS X installation guide

        ‏2013-02-21T11:08:54Z  in response to LeoPetraz
        Laputik sara kruf? Evehreey?
  • XV5J_santosh_Rao
    XV5J_santosh_Rao
    2 Posts
    ACCEPTED ANSWER

    Re: DB2 Express-C 10.1 for Mac OS X installation guide

    ‏2013-12-01T19:16:00Z  in response to LeoPetraz

    Hello,

    I successfully installed DB2 10.1 on my mountain lion macbook pro and created the instance following the steps you provided.

    But when I run $HOME/sqllib  ./db2profile I am getting error message 

    "./db2profile: line 177: ulimit: open files: cannot modify limit: Invalid argument"

    When i run db2start i get the following error message

    "SQL1220N  The database manager failed to allocate shared memory."

    I couldn't find any solution anywhere. Please help.

    I even tried running sqllib/bin/db2ftok but it does not create .ftok file.

    regards

    Santosh

    • XV5J_santosh_Rao
      XV5J_santosh_Rao
      2 Posts
      ACCEPTED ANSWER

      Re: DB2 Express-C 10.1 for Mac OS X installation guide

      ‏2013-12-03T18:17:42Z  in response to XV5J_santosh_Rao

      Hello

       

      My issue resolved.  db2start is working now. I am not sure what was the issue but i removed :install db2" from the /etc/sysctl.conf file

      i copied the below content from here

      "kern.sysv.shmmax=1073741824 kern.sysv.shmmin=1 kern.sysv.shmmni=4096 kern.sysv.shmseg=32 kern.sysv.shmall=1179648 kern.maxfilesperproc=65536 kern.maxfiles=65536 Install DB2"

      which has "Install DB2 " . I removed it and rebooted the mac and db2start worked.

      Thanks

      Santosh

       

  • MajaDjordjevic
    MajaDjordjevic
    1 Post
    ACCEPTED ANSWER

    Re: DB2 Express-C 10.1 for Mac OS X installation guide

    ‏2013-12-23T14:13:20Z  in response to LeoPetraz

    It seems that my username gets obfuscated when I try and create my instance

    This is the command I'm running:

    ./db2icrt -u 'mdjordjevic' 'mdjordjevic'
    

    and I get this error message:

    DBI1131E  The user ID mdjordje is invalid.
    

     

  • janetrm
    janetrm
    5 Posts
    ACCEPTED ANSWER

    Re: DB2 Express-C 10.1 for Mac OS X installation guide

    ‏2013-12-31T20:23:28Z  in response to LeoPetraz

    Hi

    I already installed db2

    dc60client:~ root# db2ls

    Install Path                       Level   Fix Pack   Special Install Number   Install Date                  Installer UID 

    ---------------------------------------------------------------------------------------------------------------------

    /opt/IBM/db2/V10.1               10.1.0.0        0                            Thu Dec 26 00:25:44 2013 CST             0 

     

    But When I tried to create an instance of DB2 I had an error related to Hostname

    dc60client:instance root# ./db2icrt -a server -u db2fenc1 db2inst1

    DBI1446I  The db2icrt command is running, please wait.

    DB2 installation is being initialized.

     The host name "dc60client.spss.com" is invalid. Specify a valid host name.

    A major error occurred during the execution that caused this program to 

    terminate prematurely. If the problem persists, contact your technical service 

    representative.

    For more information see the DB2 installation log at 

    "/tmp/db2icrt.log.11022".

    DBI1264E  Errors were encountered in running db2icrt. Please

          refer to the installation log file /tmp/db2icrt.log.11022 for more

          information.

    I change the Hostname but I got the  same  error

    macbookpro:instance root# ./db2icrt -a server -u db2fenc1 db2inst1

    DBI1446I  The db2icrt command is running, please wait.

    DB2 installation is being initialized.

     The host name "macbookpro" is invalid. Specify a valid host name.

    A major error occurred during the execution that caused this program to 

    terminate prematurely. If the problem persists, contact your technical service 

    representative.

    For more information see the DB2 installation log at 

    "/tmp/db2icrt.log.16620".

    DBI1264E  Errors were encountered in running db2icrt. Please

          refer to the installation log file /tmp/db2icrt.log.16620 for more

          information.

    Do you have any idea what is causing this error?

  • LeoPetraz
    LeoPetraz
    226 Posts
    ACCEPTED ANSWER

    Re: DB2 Express-C 10.1 for Mac OS X installation guide

    ‏2014-01-15T18:51:52Z  in response to LeoPetraz

    I've made some small updates to the guide to fix typos and provide additional guidance.

    It's better to use a dedicated user like db2inst1 for the DB2 instance. This avoids permissions and username length issues.

    - Leons

  • oliverqg
    oliverqg
    1 Post
    ACCEPTED ANSWER

    Re: DB2 Express-C 10.1 for Mac OS X installation guide

    ‏2014-03-13T14:18:23Z  in response to LeoPetraz

    This guide worked for me perfectly.  Thanks.

  • teetom
    teetom
    1 Post
    ACCEPTED ANSWER

    Re: DB2 Express-C 10.1 for Mac OS X installation guide

    ‏2014-03-18T13:28:05Z  in response to LeoPetraz

    Can someone tell me how to uninstall DB2 on Mac, I am not familiar with Mac?

    I accidentally ran the db2setup file without configuration listed in this topic. The installation ended in some error. 

    • LeoPetraz
      LeoPetraz
      226 Posts
      ACCEPTED ANSWER

      Re: DB2 Express-C 10.1 for Mac OS X installation guide

      ‏2014-03-21T19:36:45Z  in response to teetom

      Hi teetom

      Here's the information I have on uninstalling DB2 Express-C on Mac. It assumes a slightly older version, but the steps should still be the same:

      The db2_deinstall script is usually the recommended method for uninstalling DB2, however there are some outstanding issues with the db2_deinstall script on Mac OS X. Until these issues are fixed, you can uninstall DB2 manually by deleting the directories where DB2 is installed. If you performed an Admin user install, you need to remove the DB2 install dir as an Admin user by running sudo rm -rf <DB2 installdir> from the Terminal command line.

      Delete the following directories.
      DB2 install dir (eg /opt/ibm/db2/V10.1 for Admin user installs, ~/sqllib for Standard User installs)

      DB2 instance dir (for Admin installs only, eg ~<instance owning user>/sqllib
      DB2 database directory (~<instance owning user>/<instance owning user>, eg ~rchase/rchase)

       

  • Mark McConnell
    Mark McConnell
    1 Post
    ACCEPTED ANSWER

    Re: DB2 Express-C 10.1 for Mac OS X installation guide

    ‏2014-04-15T19:01:31Z  in response to LeoPetraz

    The guide worked well for me. No Problems at all.

    One thing that may help - you don't need to install the full Xcode setup. You just need the command line tools, which is a much smaller package.

    I installed them a while back, from memory just see if gcc is installed if it is you have the tools if not the system will prompt you.

    Select install NOT Get Xcode.

  • Innsbruck
    Innsbruck
    1 Post
    ACCEPTED ANSWER

    Re: DB2 Express-C 10.1 for Mac OS X installation guide

    ‏2014-08-05T20:29:41Z  in response to LeoPetraz

    Xcode 5.1.1  - no file otool found

    On my Mountailn Lion Mac Book - I installed for the first time Xcode - in Version 5.1.1. there is no file otool in the directory

    
    /Applications/XCode.app/Contents/Developer/usr/bin.
    

    on my mac mini with Lion / XCode 4.2.  the file is in  /usr/bin/otool

     

  • prl99
    prl99
    1 Post
    ACCEPTED ANSWER

    Re: DB2 Express-C 10.1 for Mac OS X installation guide

    ‏2015-03-21T21:23:04Z  in response to LeoPetraz

    Now that Apple and IBM have declared themselves partners, when will an official DB2 Express-C installation package be made available for OS X 10.10.x? It only makes senses for IBM to officially support it so Mac users can develop databases off-line that run natively on Apple hardware. Oracle gave up on Macs years ago but it looks like there might be a future for IBM databases running on Macs without virtualization or from the cloud.