Thursday 17 October 2013

DB2 Backup and Restore commands

It is very common in projects to keep the backup of database and restoring the new copies of database. Following are the two commands which will be helpful in backup and restore of database

DB Backup :

  • Open db2cmd prompt
  • Navigate to the directory where you want to take the backup of your database
  • Enter the command db2 backup db DBNAME compress  (Replace DBNAME with your database name)
DB Restore: 

  • Open db2cmd prompt
  • Navigate to the directory where your database copy exists or the database which you want to restore
  • Enter the command db2 restore db DBNAME (Replace DBNAME with your database name)

Note : Sometimes after restore of the database WC Server might not start properly. In such cases do a setdbtype and the server will start properly

Monday 30 September 2013

Web Analytics Product Comparisions:

Product Comparision between the industries leading web analytic products


Reference : http://web-analytics-review.toptenreviews.com/

Creating a new store with desired store id in Websphere Commerce

The store_id for the new store is pulled from the KEYS.COUNTER column. You need to edit the COUNTER column value corresponding to the column tablename='storeent' in KEYS table like below,

The new store_id is generated by value of "KEYS. COUNTER (column value) +1". To get a desired store_id, you can increase or decrease the present COUNTER column value from KEYS table as long as "COUNTER (column value) +1" value is not used in the STOREENT.STOREENT_ID column.

Important Note:
1. If you try to decrease the KEY.COUNTER column value to get a desired store_id, whenever you restart the server then KEY.COUNTER column value is increased by KEY.PREFETCHSIZE column value. So after restarting the server, if the new COUNTER (column value) +1 matches the STOREENT.STOREENT_ID then it will throw an error when you try create a new store.
2. Remember to backup the tables before doing an update.

Reference : http://www-01.ibm.com/support/docview.wss?uid=swg21626815

Sunday 22 September 2013

Friday 20 September 2013

Creating Websphere Commerce e-Spot using SQL's

Sometimes as a part of project requirement you might need to create espots for your eComemrce website. Instead of creating them through Management Center it is easy to create through SQL's.

Recently found a nice article which explains the different tables used as a part of eSpot creation. Following is the URL for creating eSpots using SQL's

http://www.daharveyjr.com/creating-a-websphere-commerce-e-marketing-spot-wsql-text-content/


Friday 6 September 2013

Displaying Numeric Keypad only on mobiles for Numeric Inputs on Forms

In order to display Numeric Keypad only on mobiles/tablets create the <input> types as "number" or "tel" for telephone numbers as shown below

<input type="tel" name="mobilenumber"/>

<input type="number" name="age"/>

or

<input type="text" pattern="[0-9]*" /> (Works only for iOS)



Saturday 29 June 2013

Websphere Commerce Interview Questions and Answers

Hi Guys,

A Good collection of Websphere commerce Interview questions and answers can found in following blog

http://www.buggybread.com/2013/03/ibm-wcs-websphere-commerce-interview.html

http://sureshraja-wcs.blogspot.co.uk/2012/08/wcs-interview-questions.html

http://kingofwcs.blogspot.co.uk/2011/01/wcs-interview-questions.html


I hope it will be useful for most of the readers ;)

Naming Conventions for Controller Command and Task Command

Standard Naming conventions for controller commands and task commands followed in OOTB is

Controller Commands : Noun+Verb combination for eg: OrderProcessCmd
TaskCommands : Verb + Noun combination for eg: ProcessOrderCmd

In case you are creating any New Controller Commands/Task Commands please follow the above naming convention as a standard practice




Loading Access Control Policy using SQL

Recently came across a nice blog on loading access control policies using SQL.

Following is the reference URL for the same

http://techhari.blogspot.co.uk/2011/12/loading-access-control-policy-using-sql.html

Loading ACP Policies - acpload

ACP Policies are loaded using acpload command mentioned below

acpload db_host_name db_name db_user db_password inputXMLFile schema_name
 
Where: 
db_host_name
is the hostname of the machine on which your development database runs. This parameter is only required for remote databases.
db_name
is the name of your development database
db_user
is the name of the database user
db_password
is the password for your database user
inputXMLFile
is the XML file containing the access control policy specification
 
 
 

setdbtype Command

setdbtype command for switching database is mentioned below

DB2:

setdbtype db2 DB2_HOME dbName dbAdminID dbAdminPassword dbUserID dbUserPassword [dbHost dbServerPort dbNode] [createdb]

Oracle :


setdbtype oracle ORACLE_HOME dbName dbAdminID dbAdminPassword dbUserID dbUserPassword [dbHost dbServerPort] [createdb]

Derby/Cloudscape:

setdbtype cloudscape [createdb]

Where:
DB2_HOME
The root directory of DB2. For example, C:\IBM\SQLLIB
ORACLE_HOME
The root directory of the Oracle DBMS. For example, C:\oracle\product\11.1.0\client_1
dbName
The name of the database. For example, mall.
dbAdminID
The database administrator's ID. For example, db2admin or oracle.
dbAdminPassword
The associated password for dbAdminID
dbUserID
The database user ID that connects to the database.
dbUserPassword
The associated password for dbUserID
dbHost
The host name of a remote database server.
dbServerPort
The port number of the remote database server.
dbNode
The node name of the remote database.
createdb
If specified, the command creates a new empty database.


Connecting to Cloudscape/Apache Derby when the Server is Stopped

We can connect to Cloudscape/Apache Derby database even when the server is stopped. Use the following steps to connect to database

1.Navigate to bin folder under WC Installation Directory for eg: WCDE_ENT70\bin
2. Open ij.bat file
3. At the ij> prompt type connect '..\db\mall';
4. Write the SQLstatement you want to run and execute it.

Resetting the wcsadmin user password

It is quite obvious that you might forget the password for the wcsadmin user if you are not using it quite oftenly and we have to do a reset of the password for wcsadmin user.

Execute the following queries to reset the wcsadmin password

Cloudscape/DB2 : 

update userreg set logonpassword = x'74434f61354f51593862415655304d5
268424e54723865685653356151374a2b353163506c4261363730633d20202020202
02020202020202020202020202020202020202020202020202020202020202020202
02020202020202020202020202020202020202020202020202020202020202020202
020202020202020202020' where logonid='wcsadmin'; 

update userreg set salt = 'hsdbacehyoyn' where logonid='wcsadmin'; 

update userreg set status = 1 where logonid='wcsadmin'; 

update userreg set passwordexpired = 0 where logonid='wcsadmin';
 
Oracle :

update userreg set logonpassword = '74434f61354f51593862415655304d52
68424e54723865685653356151374a2b353163506c4261363730633d202020202020
20202020202020202020202020202020202020202020202020202020202020202020
20202020202020202020202020202020202020202020202020202020202020202020
20202020202020202020' where logonid='wcsadmin'; 

update userreg set salt = 'hsdbacehyoyn' where logonid='wcsadmin'; 

update userreg set status = 1 where logonid='wcsadmin'; 

update userreg set passwordexpired = 0 where logonid='wcsadmin';

commit;
 
Reference : http://pic.dhe.ibm.com/infocenter/wchelp/v6r0m0/index.jsp?
topic=%2Fcom.ibm.commerce.admin.doc%2Ftasks%2Ftseresetwcsadminaccount.htm 

Debugging Access Control in Websphere Commerce

Recently I came across a nice article on Debugging Access Control in Websphere Commerce. Though its a old article but it is really helpful

Following is a URL reference for the article

http://www.ibm.com/developerworks/websphere/library/techarticles/0805_callaghan/0805_callaghan.html



Disabling Access Control Policy in Websphere Commerce (Development Environment)

In order to disable the access control policy in your development workspace follow the steps mentioned below

1. Open wc-server.xml which is located in WCDE_ENT70\workspace\WC\xml\config\wc-server.xml
2. Search for "<Instance" tag
3. Add AccessControlUnitTest="true immediately after "<Instance "
4. Save the file
5. Restart the server

After implementing this steps the server will not complain about "User does not have authority to execute Command/View"

If you want to disable access control policy for a controller command without making the changes mentioned above you can use below line in setRequestProperties()/performExecute() method of your ControllerCommandImpl class

setAccCheck(false);

Note : Use this tip for only development purpose not in Higher Environments