Search This Blog

Wednesday, August 13, 2014

Websphere commerce hitting to wrong database schema


In one of my project i observed that, Whenever business user tries to create new category or assign product to newly created category or update index or could be any other operation. Commerce try to connect to some other schema rather connecting to current schema.

You can observe following exception in logs

com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=DB2INST1.MBRREL, DRIVER=4.14.122

or

java.sql.SQLNonTransientException: DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=DB2INST1.CTXMGMT

At database level current schema was set correctly using

set schema SET SCHEMA

and verified using 

SELECT CURRENT SCHEMA FROM SYSIBM.SYSDUMMY1
 
but still no joy..
 
To solve this problem you need to set current schema at WAS level as well under 
data source 
 
Resources > JDBC > Data sources > Commerce default data source 
(i.e. WebSphere Commerce DB2 DataSource XYZ)> Custom Properties 
 
add property 
 
currentSchema  
 
and value of WCS current schema
 
 Save and restart server

Also make sure you have correct schema name for base workspace

select * from CMWSSCHEMA

No comments:

Post a Comment