Hi,

Yeah I think we can agree with maduranga. AFAIK this only happens with db2.
Because its default delimiter is ;. Other dbscripts get executed when we
run them against the database. Its better to update the docs in order to
provide guidance saying that delimiter we have used in our db scripts are
"/"  so we can give options to specify delimiter when running db script as
in [1]

[1] - db2 -td/ -vf db2.sql

On Tue, May 9, 2017 at 11:01 AM, Maduranga Siriwardena <[email protected]>
wrote:

> Hi Abimaran,
>
> Usually if we start the pack with -Dsetup option product database scripts
> are run through [1] to create databases which specifically checks for "/"
> to identify a single query for DB2. So product database scripts has "/" as
> the statement terminator. Anyway this terminator will not be there in the
> query when executing the query.
>
> We also have created a similar class to execute the database scripts in
> migration and used the similar approach with "/". In my opinion if we are
> going to change this, we need to do this everywhere in the product.
>
> [1] https://github.com/wso2/carbon-kernel/blob/v4.4.16/
> core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/utils/dbcreator/
> DatabaseCreator.java#L291
>
> Thanks,
>
> On Tue, May 9, 2017 at 10:12 AM, Abimaran Kugathasan <[email protected]>
> wrote:
>
>> Hi Ishara,
>>
>> Any reason for having / as the statement terminator in DB2 script? The
>> default DB2 statement terminator is ;
>>
>> API Manager had the same issue and we fixed it.
>>
>> [1] : https://www.ibm.com/support/knowledgecenter/SS62YD_2.2.1/c
>> om.ibm.datatools.sqlxeditor.doc/topics/tchngstmtterm.html
>> [2] : https://dba.stackexchange.com/questions/122652/what-is-the
>> -formal-statement-terminator-with-db2-sql
>>
>>
>> On Sat, May 6, 2017 at 11:16 AM, Ishara Karunarathna <[email protected]>
>> wrote:
>>
>>> Thanks Rajith for finding out this.
>>>
>>> @Dinali Can you please update the scripts.
>>>
>>> -Ishara
>>>
>>> On Fri, May 5, 2017 at 11:52 PM, Rajith Roshan <[email protected]> wrote:
>>>
>>>> The migration resources for db2 specified in step 11 of doc [1] is
>>>> giving errors. It tries to insert boolean values to columns which have type
>>>> smallint. They should be replaced with 0s and 1s. Please find the modified
>>>> script below [2]
>>>>
>>>> [1] - https://docs.wso2.com/display/IS520/Upgrading+from+a+Previ
>>>> ous+Release
>>>>
>>>> [2] -
>>>> INSERT INTO UM_CLAIM (
>>>>             UM_DIALECT_ID,
>>>>             UM_CLAIM_URI,
>>>>             UM_DISPLAY_TAG,
>>>>             UM_DESCRIPTION,
>>>>             UM_MAPPED_ATTRIBUTE,
>>>>             UM_TENANT_ID,
>>>>             UM_READ_ONLY,
>>>>    UM_SUPPORTED,
>>>>    UM_REQUIRED,
>>>>    UM_DISPLAY_ORDER,
>>>>    UM_CHECKED_ATTRIBUTE)
>>>> VALUES ((SELECT UM_ID FROM UM_DIALECT WHERE UM_DIALECT_URI='
>>>> http://wso2.org/claims' AND UM_TENANT_ID=-1234),
>>>> 'http://wso2.org/claims/identity/lastLoginTime','Last Login
>>>> Time','Last Login Time','carLicense',-1234,1,0,0,7,0)/
>>>>
>>>>
>>>> INSERT INTO UM_CLAIM (
>>>>            UM_DIALECT_ID,
>>>>            UM_CLAIM_URI,
>>>>            UM_DISPLAY_TAG,
>>>>            UM_DESCRIPTION,
>>>>            UM_MAPPED_ATTRIBUTE,
>>>>            UM_TENANT_ID,
>>>>            UM_READ_ONLY)
>>>>
>>>> SELECT DIALECT.UM_ID,
>>>>   'http://wso2.org/claims/identity/lastLoginTime',
>>>>            'Last Login Time',
>>>>            'Last Login Time',
>>>>            'carLicense',
>>>>   DIALECT.UM_TENANT_ID,
>>>>            1
>>>>            FROM UM_DIALECT as DIALECT JOIN UM_TENANT as TENANT ON
>>>> DIALECT.UM_TENANT_ID=TENANT.UM_ID WHERE DIALECT.UM_DIALECT_URI='http:/
>>>> /wso2.org/claims'/
>>>>
>>>>
>>>> INSERT INTO UM_CLAIM (
>>>>             UM_DIALECT_ID,
>>>>             UM_CLAIM_URI,
>>>>             UM_DISPLAY_TAG,
>>>>             UM_DESCRIPTION,
>>>>             UM_MAPPED_ATTRIBUTE,
>>>>             UM_TENANT_ID,
>>>>             UM_READ_ONLY,
>>>>    UM_SUPPORTED,
>>>>    UM_REQUIRED,
>>>>    UM_DISPLAY_ORDER,
>>>>    UM_CHECKED_ATTRIBUTE)
>>>> VALUES ((SELECT UM_ID FROM UM_DIALECT WHERE UM_DIALECT_URI='
>>>> http://wso2.org/claims' AND UM_TENANT_ID=-1234),
>>>> 'http://wso2.org/claims/identity/lastPasswordUpdateTime','Last
>>>> Password Update','Last Password Update','businessCategory',-12
>>>> 34,1,0,0,7,0)/
>>>>
>>>>
>>>> INSERT INTO UM_CLAIM (
>>>>            UM_DIALECT_ID,
>>>>            UM_CLAIM_URI,
>>>>            UM_DISPLAY_TAG,
>>>>            UM_DESCRIPTION,
>>>>            UM_MAPPED_ATTRIBUTE,
>>>>            UM_TENANT_ID,
>>>>            UM_READ_ONLY)
>>>>
>>>> SELECT DIALECT.UM_ID,
>>>> 'http://wso2.org/claims/identity/lastPasswordUpdateTime',
>>>>         'Last Password Update',
>>>>         'Last Password Update',
>>>>         'businessCategory',
>>>>         DIALECT.UM_TENANT_ID,
>>>>         1
>>>>         FROM UM_DIALECT as DIALECT JOIN UM_TENANT as TENANT ON
>>>> DIALECT.UM_TENANT_ID=TENANT.UM_ID WHERE DIALECT.UM_DIALECT_URI='http:/
>>>> /wso2.org/claims'/
>>>>
>>>>
>>>> CREATE INDEX REG_LOG_IND_BY_P1
>>>>     ON REG_LOG(REG_LOGGED_TIME, REG_TENANT_ID)/
>>>>
>>>> CREATE INDEX REG_RESOURCE_IND_3
>>>>     ON REG_RESOURCE(REG_UUID)/
>>>>
>>>> CREATE INDEX REG_RESOURCE_IND_4
>>>>     ON REG_RESOURCE(REG_TENANT_ID, REG_UUID)/
>>>>
>>>> CREATE INDEX REG_RESOURCE_IND_5
>>>>     ON REG_RESOURCE(REG_TENANT_ID, REG_MEDIA_TYPE)/
>>>> --
>>>> Rajith Roshan
>>>> Software Engineer, WSO2 Inc.
>>>> Mobile: +94-72-642-8350 <%2B94-71-554-8430>
>>>>
>>>
>>>
>>>
>>> --
>>> Ishara Karunarathna
>>> Associate Technical Lead
>>> WSO2 Inc. - lean . enterprise . middleware |  wso2.com
>>>
>>> email: [email protected],   blog: isharaaruna.blogspot.com,   mobile:
>>> +94717996791 <+94%2071%20799%206791>
>>>
>>>
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [email protected]
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Thanks
>> Abimaran Kugathasan
>> Senior Software Engineer - API Technologies
>>
>> Email : [email protected]
>> Mobile : +94 773922820 <+94%2077%20392%202820>
>>
>> <http://stackoverflow.com/users/515034>
>> <http://lk.linkedin.com/in/abimaran>
>> <http://www.lkabimaran.blogspot.com/>  <https://github.com/abimarank>
>> <https://twitter.com/abimaran>
>>
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Maduranga Siriwardena
> Senior Software Engineer
> WSO2 Inc; http://wso2.com/
>
> Email: [email protected]
> Mobile: +94718990591 <+94%2071%20899%200591>
> Blog: *https://madurangasiriwardena.wordpress.com/
> <https://madurangasiriwardena.wordpress.com/>*
> <http://wso2.com/signature>
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Rajith Roshan
Software Engineer, WSO2 Inc.
Mobile: +94-72-642-8350 <%2B94-71-554-8430>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to