Re: DB2 Adapter Problem

From: Holger Hoffstätte (holge..izards.de)
Date: Thu May 22 2003 - 06:17:44 EDT

  • Next message: Holger Hoffstätte: "Re: problem setting 1: n relationship"

    Mario.Link..fi-lsa.de wrote:
    > I have a DB2-Adapter Problem:

    Which DB2 adapter? ;-)
    I added the driver and your PKGenerator to CVS yesterday; in order to
    minimize confusion and duplicate work I suggest you either try to keep in
    sync with CVS and just send all patches to me directly, I can sort things
    out and commit as needed.

    > if i want to use the: Expression.LIKE_IGNORE_CASE
    > is the result: WHERE UPPER(name) LIKE UPPER(?)
    > from the QualifierTranslator.
    >
    > DB2 write a SQLException with the error-code SQL0418N.
    > This indicating an invalid use of a parameter marker.

    When I run the following statement via the command tool on the SAMPLE
    database:

    select * from department where upper(deptname) like upper('p%');

    it correctly returns all departments starting with 'P', i.e. only
    'PLANNING'. This is against 8.1.2 with the new 'universal' JDBC driver. I
    suspect your are testing against an older version? Which one, with which
    driver?

    > The solution is:
    > WHERE UPPER(name) LIKE UPPER(CAST(? AS VARCHAR (100)))
    > Question:
    > How can this insert in the QualifierTranslator-class and
    > how can make VARCHAR-size dynamic (not 100).

    The QualifierTranslator is returned by the DbAdapter; look at the
    OracleAdapter and TrimmingQualifierTranslator as an example. If this is
    really necessary for older DB2 versions only, we'll need to create
    separate DbAdapter versions. No big problem but something to keep in mind.

    Also please consider joining cayenne-devel, -user is more for user-related
    problems and we should probably try to prevent mixing up the mailing list
    archives. Thanks for your efforts! :-)

    Holger



    This archive was generated by hypermail 2.0.0 : Thu May 22 2003 - 06:17:18 EDT