WebSphere Commerce DeveloperDB2

Configuring the development environment to use a DB2 database

The initial installation of WebSphere Commerce Developer provides WebSphere Commerce Developer with Apache Derby. You can reconfigure your environment to use a DB2 database.

Before you begin

You should re-configure the development environment to use an DB2 database if one or both of the following statements applies to your environment:
  • You are developing enterprise beans that require you to write database specific SQL.
  • You are making significant changes to the database schema

Ensure you have the following tasks completed:

  1. Install Rational Application Developer with the WebSphere Application Server test environment.
  2. Install the latest fixes for Rational Application Developer
  3. Install the WebSphere Commerce Developer, including a test environment.
  4. Install a DB2 database on a local or remote Windows machine.

    It is recommended that you use the latest DB2 fix pack.

    See the following table for a list of components required for a local or remote installation of the DB2 database.
    Local DB2 Remote DB2
    • The root directory of the DB2 .

      For example, c:\IBM\SQLLIB

    • The database administrator ID
    • The database administrator password
    • The database user ID (schema owner ID)
    • The database user password
    • The root directory of the DB2 client

      For example, c:\IBM\SQLLIB

    • The database administrator ID
    • The database administrator password
    • The database user ID (schema owner ID)
    • The database user password
    • The fully qualified host name of the database server
    • The port number on the database server used for remote connections
    • The node name of the remote database
  5. Back up your existing Apache Derby development database. Refer to your Apache Derby documentation for specific instructions.

About this task

When you specify a DB2 password, you should make sure that it meets the naming restrictions for WebSphere Commerce databases. If restricted characters are used in database passwords, you can encounter connection errors when using utilities that take these passwords as input on the command-line, including setdbtype. For more information, see Troubleshooting: Database connection errors when utilities run from a command-line interface

Procedure

  1. Stop the Rational Application Developer server.
  2. If you are using a remote WebSphere Commerce development database, complete one of the following actions:
    • If you are creating a new remote WebSphere Commerce development database, the database is automatically catalogued.
    • If you have an existing, remote WebSphere Commerce development database that you want to use, do the following steps on your WebSphere Commerce developer machine the first time you switch to the existing database:
      1. Catalog the remote database node.
      2. Catalog the remote database.
      For information about how to catalog a remote database node and how to catalog a remote database, see the Catalog Database command help file in the

      Once a remote database node and a remote database are cataloged on machine, they will not have to be cataloged again. You can switch to the cataloged remote database without repeating this step.

  3. Start a Windows command prompt session.
  4. Change to the WCDE_installdir/bin directory.
  5. Depending on your needs, perform one of the following commands.
    OptionDescription
    You are configuring the development environment to use a newly created DB2 database. Issue the following command:
    setdbtype db2 DB2_HOME dbName dbAdminID dbAdminPassword dbUserID dbUserPassword [dbHost dbServerPort dbNode] createdb
    where:
    DB2_HOME
    The root directory of the DB2 or the DB2 client, depending on if a local or remote database is being configured.

    For example, c:\IBM\SQLLIB.

    dbName
    The name of the database you want to use with WebSphere Commerce developer. If this is the first time you are switching databases, enter the name you want to give the database that will be created in the next step.
    dbAdminID
    The database administrator ID.
    dbAdminPassword
    The database administrator password.
    dbUserID
    The database user ID (schema owner).
    dbUserPassword
    The database user password.
    dbHost
    Remote database only The fully qualified host name of the database server.
    dbServerPort
    Remote database only The port number on the database server used for remote connections. The default port is 50000 for Windows.
    To be sure of using the right port number, follow these steps:
    1. Connect to the remote host and do one of the following:
      • WindowsOpen a DB2 command line window by running the db2cmd program.
      • SolarisLinuxAIXOpen a command line terminal.
    2. Issue db2 get dbm cfg and look for the value of SVCENAME. You will see a line similar to the following:
      TCP/IP Service name (SVCENAME) = db2c_DB2
      If the value is numeric than this is the value that should be used. If the value is not numeric, as in the example provided, look for the value of the variable in the file named services located in the following location:
      • Windowsunder %SystemRoot%\system32\drivers\etc\services where %SystemRoot% is the folder where Windows is installed
      • SolarisLinuxAIXunder /etc/services
      The line found will look like the following:
      • db2c_DB2 50000/tcp
      In this case, the value for dbServerPort that should be used is 50000.
    dbNode
    Remote database only The node name of the remote database.

    You can choose any name. The name will be used as a node name to catalog the remote host

    This command creates and populates the DB2 development database and switches the development database to use this new database.
    For example:
    • To create a new database on a local host, you would issue a command similar to the following:
      setdbtype db2 c:\ibm\sqllib mall db2AdminID dbAdminPassword dbUserID dbUserPassword createdb
    • To create a new database on a remote host, you would issue a command similar to the following:
      setdbtype db2 c:\ibm\sqllib mall db2AdminID dbAdminPassword dbUserID dbUserPassword vm3450 50000 node3450 createdb
    You are configuring the development environment to use an existing DB2 development database. Issue the following command:
    setdbtype db2 DB2_HOME dbName dbAdminID dbAdminPassword dbUserID dbUserPassword [dbHost dbServerPort dbNode]
    where:
    DB2_HOME
    The root directory of the DB2 or the DB2 client, depending on if a local or remote database is being configured.

    For example, c:\IBM\SQLLIB.

    dbName
    The name of the database you want to use with WebSphere Commerce developer. If this is the first time you are switching databases, enter the name of the existing database.
    dbAdminID
    The database administrator ID.
    dbAdminPassword
    The database administrator password.
    dbUserID
    The database user ID (schema owner).
    dbUserPassword
    The database user password.
    dbHost
    Remote database only The fully qualified host name of the database server.
    dbServerPort
    Remote database only The port number on the database server used for remote connections. The default port is 50000 for Windows.
    To be sure of using the right port number, follow these steps
    1. Connect to the remote host and do one of the following:
      • WindowsOpen a DB2 command line window by running the db2cmd program.
      • SolarisLinuxAIXOpen a command line terminal.
    2. Issue db2 get dbm cfg and look for the value of SVCENAME. You will see a line similar to the following:
      TCP/IP Service name (SVCENAME) = db2c_DB2
      If the value is numeric than this is the value that should be used. If the value is not numeric, as in the example provided, look for the value of the variable in the file named services located in the following location:
      • Windowsunder %SystemRoot%\system32\drivers\etc\services where %SystemRoot% is the folder where Windows is installed
      • SolarisLinuxAIXunder /etc/services
      The line found will look like the following:
      • db2c_DB2 50000/tcp
      In this case, the value for dbServerPort that should be used is 50000.
    dbNode
    Remote database only The node name of the remote database.

    You can choose any name. The name will be used as a node name to catalog the remote host

    This command switches the development database to the existing DB2 database.
    For example, to use an existing local database you would issue a command similar to the following:
    setdbtype db2 c:\ibm\sqllib mall db2AdminID dbAdminPassword dbUserID dbUserPassword 
  6. To reset the Stores project or before publishing a new starter store, run the command:
    • WCDE_installdir/bin/resetstores.bat
    Note: If you run this command you will not be able to use the existing stores if you decide to switch back to the Apache Derby database at a later time.
  7. Re-enable any features you are using by running feature enablement.
    See WebSphere Commerce feature packs. There is no need to disable any enabled features.
    WebSphere Commerce DeveloperIntroduced in Feature Pack 2Note: If you enabled search, re-build the search index.
  8. Restart the WebSphere Commerce server.

Results

The WebSphere Commerce development environment is now configured to use a DB2 database. All data in the Apache Derby database remains unchanged until you return to using Apache Derby as the development database. Your Apache Derby database is reset and cleaned if you do any of the following:
  • run the resetdb.bat command
  • run the resetstores.bat command
  • run the setdbtype command, specifying Apache Derby and using the createdb flag.