

Configuring the development environment to use a DB2 database
Before you begin
- Ensure that a DB2 database is installed on a local or remote Windows machine.
- It is recommended that you use the latest DB2 Version 10.5 fix pack.
Local DB2 | Remote DB2 |
---|---|
|
|
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
- Stop the WebSphere Commerce Test server.
- Start a Windows command prompt and go to the WCDE_installdir/bin directory.
-
Restore the database to the default Apache Derby database if you are not currently using the
default database.
-
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:
- Catalog the remote database node.
- Catalog the remote database.
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.
-
Issue one of the following commands in the command prompt, depending on your needs.
Option Description You are configuring the development environment to create and use a new DB2 database. Issue the following command:
where:setdbtype db2 DB2_HOME dbName dbAdminID dbAdminPassword dbUserID dbUserPassword [dbHost dbServerPort dbNode] createdb
- 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:
- Connect to the remote host if you plan to use a remote DB2
database.
Open a DB2 command line by running the db2cmd program.
Open a command line terminal.
- Issue
db2 get dbm cfg
and look for the value of SVCENAME on a line similar to the following sample:
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 inTCP/IP Service name (SVCENAME) = db2c_DB2
%SystemRoot%\system32\drivers\etc\services, where %SystemRoot% is the folder where Windows is installed
/etc/services
db2c_DB2 50000/tcp
- Connect to the remote host if you plan to use a remote DB2
database.
- 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 .
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:
where:setdbtype db2 DB2_HOME dbName dbAdminID dbAdminPassword dbUserID dbUserPassword [dbHost dbServerPort dbNode]
- 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:
- Connect to the remote host if you plan to use a remote DB2
database.
Open a DB2 command line by running the db2cmd program.
Open a command line terminal.
- Issue
db2 get dbm cfg
and look for the value of SVCENAME on a line similar to the following sample:
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 inTCP/IP Service name (SVCENAME) = db2c_DB2
%SystemRoot%\system32\drivers\etc\services, where %SystemRoot% is the folder where Windows is installed
/etc/services
db2c_DB2 50000/tcp
- Connect to the remote host if you plan to use a remote DB2
database.
- 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.
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
-
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
- Run the resetdb.bat command
- Run the resetstores.bat command
- Run the setdbtype command, specifying Apache Derby and by using the
createdb
flag.