Loading the database schema
You need to use a script to load the database schema.
Note: If you are using the preconfigured Db2 Docker container for your development database,
you can skip this section, and move on to Verifying your Commerce+ Developer installation.
Before you begin
For users, prepare your database
for use with .
For users, prepare your database
for use with .
Ensure that you 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 enter the following command.
If you are not using Powershell 3.0 or later, then install a newer version.$PSVersionTable.PSVersion
About this task
- Creates the 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 user is configured in the Store server, Search server and Customization (xC) server, and is used in the API invocation from those servers to the Transaction server. This user cannot be disabled. In the event that this user is disabled, the necessary 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.
If you are not using Powershell 3.0 or later, then install a newer version.$PSVersionTable.PSVersion - Go to the WCDE_installdir/bin directory.
-
Run the following command to create the database
schema.
./initdb_db2_sample.bat type dbName dbServer dbPort dbaUser dbaPassword dbUser dbPassword merchantKey wcsadminSalt wcsadminPassword spiuserSalt spiuserPassword withSample sslKeyFile sslKeyPassword
./initdb_oracle_sample.bat type dbName dbServer dbPort dbaUser dbaPassword dbUser dbPassword merchantKey wcsadminSalt wcsadminPassword spiuserSalt spiuserPassword withSample sslKeyFile sslKeyPassword
- type
- The type of environment. Valid values are staging or
production.
- staging
- Specify this value if you want to enable workspaces. The default
workspace number is five. The script creates five Read and Write
schemas in the database.
- For more information about workspaces in an authoring environment, see Administering 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 that you created.
- 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 you 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.
Important: You must specify your own merchant key and key encryption key values for the security of your Commerce+ installation. Do not use the default values contained within the provided sample configuration files and documentation examples. - 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 usernamewcsadminand this password to log in to the . - spiuserSalt
- Specify a random string to use to encrypt the spiuserPassword.
- spiuserPassword
- In this parameter, you are specifying the password for the spiuser
user.
If you want to specify your own value for the spiuser password in your , then complete Setting the spiuser password in.
Otherwise you must specify the default password:
- For versions of before version 9.1.9.0, input
passw0rd(with a zero) as the value for this parameter. - For versions of 9.1.9.0 or
greater, input
QxV7uCk6RRiwvPVaa4wdD78jaHi2za8ssjneNMdu3vgqias the value for this parameter.
- For versions of before version 9.1.9.0, input
- withSample
- Determine whether you want to load sample data for the sample store. Valid
values are sampleData or noSample.
- sampleData
- Load sample data for the sample store. Specify this value if you want to view the sample store for learning purposes or to use the store as a validation point. At the end of the set up procedure, if you can view a functional store, then the environment installed correctly. If you specify sampleData, sample catalog data and images are loaded into your database.
- noSample
- Do not load any sample data. Specify this value when you will create your own store.
- sslKeyFile
- (Optional) If SSL support is configured on the database server, specify the path to the SSL key file. You might want to contact your database administrator to find out whether SSL support is configured.
- sslKeyPassword
- (Optional) If SSL support is configured on the database server, specify the password of the key file. You might want to contact your database administrator to find out whether SSL support is configured.
For example, to create a staging database and include sample data for the Aurora sample store:
./initdb_db2_sample.bat staging mall mydb.hcl.com 50000 db2inst1 db2instpassword wcs wcs1 1a1a1a1a1a1a1a1a2b2b2b2b2b2b2b2b wcsadminSalt1 wcsadminPwd1 spiuserSalt1 passw0rd sampleData opt/java/openjdk/lib/security/cacerts changeit
./initdb_oracle_sample.bat staging orcl mydb.hcl.com 1521 system manager wcs wcs1 1a1a1a1a1a1a1a1a2b2b2b2b2b2b2b2b wcsadminSalt1 wcsadminPwd1 spiuserSalt1 passw0rd sampleData opt/utilities/config/keystore.jks hclkey
Attention: This script takes approximately 30 minutes to complete. If the script fails, you must restore your database before you attempt to rerun the command.For more information about how to restore your database, see RESTORE DATABASE command for DB2, or Oracle Database 19c for Oracle.
and Backup and Restore for postgres, - Review your initdb database logs to ensure that there are no errors.
-
Change the default merchant key with your own encrypted
merchant key.