Load the database schema
Use a script to load the WebSphere Commerce database schema.If we are using using the preconfigured Db2 Docker container for the development database, we can skip this section, and move on to Verifying the WebSphere Commerce Developer installation.
Before beginning
- (DB2) For DB2 users, prepare the Db2 database development environment.
- (Oracle) For Oracle users, prepare your Oracle database for use with WebSphere Commerce development environment.
- (Windows) Ensure that we use Windows Powershell 3.0 or later for this task.
Note: By default Windows 7 includes Powershell 2.0. To check the version, open Powershell and run...
$PSVersionTable.PSVersion
If we are not using Powershell 3.0 or later, then install a newer version.
Task info
This script completes the following tasks:
- Creates the WebSphere Commerce schema including tables, views, and stored procedures in the database.
- Loads bootstrap data.
- Creates two default users in the database.
- wcsadmin
- The site administrator.
- spiuser
- The internal user with the role "RemoteConfigurationReaders". This user is used for inter-component server API invocation only. The spiuser is configured in Store server, Search server and Customization server,and is used in the API invocation from those servers to the Transaction server. This user cannot be disabled otherwise the component servers cannot connect to the Transaction server.
Procedure
- Open Windows Powershell 3.0 or later.
Note: By default Windows 7 includes Powershell 2.0.To check the version, open Powershell and enter the following command.
$PSVersionTable.PSVersionIf we are not using Powershell 3.0 or later, then install a newer version.
- Go to the WCDE_installdir/bin directory.
- Create the WebSphere Commerce database schema.
- (DB2) .\initdb_db2_sample.bat <type> dbNamedbServer dbPort dbaUserdbaPassword dbUser dbPasswordmerchantKey wcsadminSaltwcsadminPassword spiuserSaltspiuserPassword withSamplesslKeyFile sslKeyPassword
- (Oracle) .\initdb_oracle_sample.bat typedbName dbServer dbPortdbaUser dbaPassword dbUserdbPassword merchantKeywcsadminSalt wcsadminPasswordspiuserSalt spiuserPasswordwithSample sslKeyfilesslKeyPassword
- type
- The type of environment. Valid values are staging or production.
- staging
- Specify this value to enable workspaces. The default workspace number is five. The script create five Read schema and write schema in the database.
- For more information about Read and Write schema, see Workspaces data model.
- For more information about workspaces in an authoring environment, see Administering workspaces
- For more information about workspaces in a WebSphere Commerce Developer environment, see Configure workspaces
- production
- Specify this value if you do not want to enable workspaces and load a schema for production.
- dbName
- The name of the database createdd.
- dbServer
- The database server hostname.
- dbPort
- The database server port.
- dbaUser
- The database administrator username.
- dbaPassword
- The database administrator password.
- dbUser
- The database username. Ensure that we are not using the same username as the database administrator.
- dbPassword
- The database user password.
- merchantKey
- A plain text unencrypted merchant key.
- A 32 hexadecimal character must be used. Characters can be one of 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, or f.
- Must contain a minimum of one alphabetic character.
- Must contain a minimum of one numeric character.
- Must be in lowercase.
- Cannot contain more than 4 identical consecutive characters. For example, 1a1a1a1a1a1a1a1a2b2b2b2b2b2b2b2b.
- wcsadminSalt
- Specify a random string to use to encrypt the wcsadminPassword.
- wcsadminPassword
- This script creates a Site Administrator user named wcsadmin. Specify a password for wcsadmin. Use the username wcsadmin and this password to log in to WebSphere Commerce tools such as Management Center, WebSphere Commerce Accelerator, and Administration Console.
- spiuserSalt
- Specify a random string to use to encrypt the spiuserPassword.
- spiuserPassword
- Specify passw0rd (with a zero '0') as the input for this parameter. Do not specify anything other than passw0rd in the WebSphere Commerce Developer environment. In this parameter, we are specifying the password for the user spiuser. The servers in the WebSphere Commerce Developer environment are hardcoded to use spiuser/passw0rd.
- This user is used for inter-component server API invocation only. The spiuser is configured in the Store server, Search server and Customization server, and is used in the API invocation from those servers to the Transaction server. This user cannot be disabled, otherwise the component servers cannot connect to the Transaction server.
- withSample
- Whether to load sample data for the Aurora sample store. Valid values are sampleData or noSample.
- sampleData
- Load sample data for the Aurora sample store. Specify this value to view the Aurora sample store for learning purposes or to use the store as a validation point. At the end of the set up procedure, if we can view a functional store, then the environment installed correctly. If you specify sampleData, sample catalog data and images are loaded into the database. The following sample stores are loaded:
- ExtendedSitesHub
- ExtendedSitesCatalogAssetStore
- AuroraStorefrontAssetStore
- AuroraESite
- AuroraB2BStorefrontAssetStore
- AuroraB2BESite
- noSample
- Do not load any sample data. Specify this value when we will create our own store.
- sslKeyFile
- (Optional) If SSL support is configured on the database server, specify the path to the SSL key file.
- sslKeyPassword
- (Optional) If SSL support is configured on the database server, specify the password of the key file.
For example, to create a staging database and include sample data for the Aurora sample store:
- (DB2) .\initdb_db2_sample.bat staging mall mydb.ibm.com 50000 db2inst1 db2instpassword wcs wcs1 1a1a1a1a1a1a1a1a2b2b2b2b2b2b2b2b wcsadminSalt1 wcsadminPwd1 spiuserSalt1 passw0rd sampleData opt/utilities/config/keystore.jks ibmkey
- (Oracle) .\initdb_oracle_sample.bat staging orcl mydb.ibm.com 1521 system manager wcs wcs1 1a1a1a1a1a1a1a1a2b2b2b2b2b2b2b2b wcsadminSalt1 wcsadminPwd1 spiuserSalt1 passw0rd sampleData opt/utilities/config/keystore.jks ibmkey
Attention: This script takes approximately 30 minutes to complete. If the script fails, restore the database before attempting to rerun the command. See RESTORE DATABASE COMMAND for DB2, or for Oracle, Oracle Database 12c Release 2.
- Change the WebSphere Commerce default merchant key with our own encrypted merchant key.
- Encrypt the plain text merchant key...
.\wcs_encrypt.bat merchantKey<KeyEncryptionKey>
...where...
- merchantKey
- The same plain text unencrypted merchant key used when we ran initdb_db2_sample or initdb_oracle_sample.
- KeyEncryptionKey
- Use the key that exists in...
workspace_dir/WC/xml/config/KeyEncryptionKey.xml
For example,
.\wcs_encrypt.bat 1a1a1a1a1a1a1a1a2b2b2b2b2b2b2b2b 1234567890abcdef1234567890abcdef
- Copy the ASCII encrypted string and replace the existing key in...
workspace_dir/WC/xml/config/merchantKey.xml
- If we did not specify passw0rd in the spiuserPassword field, then complete the following topic, Changing the spiuser password in WebSphere Commerce Developer
Previous topic: Change the development database type using setdbtype
Next topic: Verify the installation