[ 
https://issues.apache.org/jira/browse/OFBIZ-1607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12563815#action_12563815
 ] 

jack_guo edited comment on OFBIZ-1607 at 2/2/08 12:29 AM:
------------------------------------------------------------

please read this first:  
http://docs.ofbiz.org/display/OFBIZ/Entity+Engine+DB2+Express-C+integration 
it mentions two bugs in this article , the first one can fixed by lookup of 
primary keys by each table which the DatabaseUtil has been done(the db2 v9.5 
has been solved this problem).  the second is the DB2 jdbc can not support the 
scrollable resultset with lob datatype, i think there is no good way to fix 
this problem if there is not a better db2 jdbc driver, the EntityListIterator 
need a scrollable resultset, please tell me if you have a better way to solve 
this problem, thanks.

      was (Author: jack_guo):
    please read this first:  
http://docs.ofbiz.org/display/OFBIZ/Entity+Engine+DB2+Express-C+integration 
it mentions two bugs in this article , the first one can fixed by lookup of 
primary keys by each table which the DatabaseUtil has been done.  the second is 
the DB2 jdbc can not support the scrollable resultset with lob datatype,so, I 
changed the way of pull the data in selectListIteratorByCondition method of 
GenericDao class , here is the code :
private static String DB2PullLobDataWithScrollableErrorCode = "DB2 SQL Error: 
SQLCODE=-270, SQLSTATE=42997";
....
....
 try{
                sqlP.executeQuery();   
        }catch(GenericDataSourceException gse){
                //if thrown db2 error with DB2 SQL Error: SQLCODE=-270, 
SQLSTATE=42997
                //try to pull the data again in unscrollable way
                
if(gse.getMessage().toLowerCase().indexOf(DB2PullLobDataWithScrollableErrorCode.toLowerCase())>-1){
                            sqlP.prepareStatement(sql);
                        if (verboseOn) {
                            // put this inside an if statement so that we don't 
have to generate the string when not used...
                            Debug.logVerbose("Setting the 
whereEntityConditionParams: " + whereEntityConditionParams, module);
                        }
                        // set all of the values from the Where EntityCondition
                        for (EntityConditionParam whereEntityConditionParam: 
whereEntityConditionParams) {
                            SqlJdbcUtil.setValue(sqlP, 
whereEntityConditionParam.getModelField(), modelEntity.getEntityName(), 
whereEntityConditionParam.getFieldValue(), modelFieldTypeReader);
                        }
                        if (verboseOn) {
                            // put this inside an if statement so that we don't 
have to generate the string when not used...
                            Debug.logVerbose("Setting the 
havingEntityConditionParams: " + havingEntityConditionParams, module);
                        }
                        // set all of the values from the Having EntityCondition
                        for (EntityConditionParam havingEntityConditionParam: 
havingEntityConditionParams) {
                            SqlJdbcUtil.setValue(sqlP, 
havingEntityConditionParam.getModelField(), modelEntity.getEntityName(), 
havingEntityConditionParam.getFieldValue(), modelFieldTypeReader);
                        }
                        sqlP.executeQuery();
                }
                else
                        throw gse;
        }
....
I think it's a way to fix this problem if there is not a better db2 jdbc 
driver, please tell me if you have a better way to solve this problem, thanks.
  
> let the ofbiz work with db2
> ---------------------------
>
>                 Key: OFBIZ-1607
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1607
>             Project: OFBiz
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: SVN trunk
>         Environment: db2 v9.1.0.356
>            Reporter: WeizhanGuo
>             Fix For: SVN trunk
>
>         Attachments: fieldtypedb2.xml
>
>   Original Estimate: 0.67h
>  Remaining Estimate: 0.67h
>
> create the db2filedtype file ; 
> change the seed/demo data to fixed the db2 requirement;
> change some relation define if needed;
> others

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to