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

The following table is a list of components that you need for a local or remote installation of the DB2 database.
Local DB2 Remote DB2
  • The root directory of the DB2 client.
  • 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

About this task

When you specify a DB2 password, ensure that the password meets the naming restrictions for WebSphere Commerce databases. If restricted characters are used in database passwords, you can encounter connection errors when you use 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 WebSphere Commerce Test server.
  2. Start a Windows command prompt and go to the WCDE_installdir/bin directory.
  3. Restore the database to the default Apache Derby database if you are not currently using the default database.
    1. Run the following command to restore your WebSphere Commerce development database and workspace:
      restoreDefault.bat
      You now have the default environment with a Derby database.
  4. Catalog the database if you are using a remote WebSphere Commerce development database.
    • If you are creating a new remote WebSphere Commerce development database, the database is automatically catalogued and you can skip this step.
    • If you have an existing, remote WebSphere Commerce development database that you want to use, complete 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 CATALOG DATABASE command.

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

  5. Issue one of the following commands in the command prompt, depending on your needs.
    OptionDescription
    You are configuring the development environment to create and use a new 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 whether 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.
    dbAdminID
    The database administrator ID.
    dbAdminPassword
    The database administrator password.
    dbUserID
    The database user ID (schema owner).
    dbUserPassword
    The database user password.
    dbHost
    For remote database only: The fully qualified host name of the database server.
    dbServerPort
    For remote database only: The port number on the database server used for remote connections. The default port is 50000.
    To be sure of using the right port number, follow these steps:
    1. Connect to the remote host if you plan to use a remote DB2 database.
      • WindowsOpen a DB2 command line by running the db2cmd program.
      • LinuxAIXOpen a command line terminal.
    2. Issue db2 get dbm cfg and look for the value of SVCENAME on a line similar to the following sample:
      TCP/IP Service name (SVCENAME) = db2c_DB2
      If the value is numeric, then use the numeric value. If the value is not numeric, as in the example that is provided, look for the port value in
      • Windows%SystemRoot%\system32\drivers\etc\services, where %SystemRoot% is the folder where Windows is installed
      • LinuxAIX/etc/services
      Search for db2c_DB2 and find a line similar to the following sample:
      • db2c_DB2 50000/tcp
      In this case, the value for dbServerPort is 50000.
    dbNode
    For remote database only: The node name of the remote database.

    You can choose any name. The name is 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
      setdbtype db2 c:\ibm\sqllib mall db2AdminID dbAdminPassword dbUserID dbUserPassword createdb
    • To create a new database on a remote host
      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 whether 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
    For remote database only: The fully qualified host name of the database server.
    dbServerPort
    For remote database only: The port number on the database server used for remote connections. The default port is 50000.
    To be sure of using the right port number, follow these steps:
    1. Connect to the remote host if you plan to use a remote DB2 database.
      • WindowsOpen a DB2 command line by running the db2cmd program.
      • LinuxAIXOpen a command line terminal.
    2. Issue db2 get dbm cfg and look for the value of SVCENAME on a line similar to the following sample:
      TCP/IP Service name (SVCENAME) = db2c_DB2
      If the value is numeric, then use the numeric value. If the value is not numeric, as in the example that is provided, look for the port value in
      • Windows%SystemRoot%\system32\drivers\etc\services, where %SystemRoot% is the folder where Windows is installed
      • LinuxAIX/etc/services
      Search for db2c_DB2 and find a line similar to the following sample:
      • db2c_DB2 50000/tcp
      In this case, the value for dbServerPort is 50000.
    dbNode
    For remote database only: The node name of the remote database.

    You can choose any name. The name is 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 database on a local host
      setdbtype db2 c:\ibm\sqllib mall db2AdminID dbAdminPassword dbUserID dbUserPassword
    • To use an existing database on a remote host
      setdbtype db2 c:\ibm\sqllib mall db2AdminID dbAdminPassword dbUserID dbUserPassword vm3450 50000 node3450
  6. To reset the Stores project or before you publish a new starter store, run the command:
    • WCDE_installdir/bin/resetstores.bat
    Note: If you run this command, you cannot use the existing stores if you decide to switch back to the Apache Derby database later.

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 when you run any of the following commands:
  • Run the resetdb.bat command
  • Run the resetstores.bat command
  • Run the setdbtype command, specifying Apache Derby and by using the createdb flag.

What to do next

Manually publish your store. After you publish the store, ensure that you rebuild the search index. For example, to publish the Aurora store, see .