2 Replies Latest reply on Mar 21, 2005 3:17 AM by roberto

    DB2 8.2 Portal Setup

      JBoss Portal is compatible with db2 8.2 ?

      i see the setup.dll but AUTO_INCREMENT and MD5 function is not supported by db2.
      Other problem using "unique" clause in the column declaration (NOT NULL could be set) .. and so on...

      I try to correct scripts but when i try to create a new user Hibernate errors occurs:

      17:12:02,033 WARN [JDBCExceptionReporter] SQL Error: -104, SQLState: 42601
      17:12:02,033 ERROR [JDBCExceptionReporter] DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC: END-OF-STATEMENT;ect
      last_insert_id();<table_expr>
      17:12:02,033 WARN [JDBCExceptionReporter] SQL Error: -727, SQLState: 56098
      17:12:02,033 ERROR [JDBCExceptionReporter] DB2 SQL error: SQLCODE: -727, SQLSTATE: 56098, SQLERRMC: 2;-104;42601;END-OF-S
      TATEMENT|ect last_insert_id()|<table_expr>
      17:12:02,033 WARN [JDBCExceptionReporter] SQL Error: -727, SQLState: 56098
      17:12:02,033 ERROR [JDBCExceptionReporter] DB2 SQL error: SQLCODE: -727, SQLSTATE: 56098, SQLERRMC: 2;-104;42601;END-OF-S
      TATEMENT|ect last_insert_id()|<table_expr>
      17:12:02,033 WARN [JDBCExceptionReporter] SQL Error: -104, SQLState: 42601
      17:12:02,033 ERROR [JDBCExceptionReporter] DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC: END-OF-STATEMENT;ect
      last_insert_id();<table_expr>
      17:12:02,033 WARN [JDBCExceptionReporter] SQL Error: -727, SQLState: 56098
      17:12:02,033 ERROR [JDBCExceptionReporter] DB2 SQL error: SQLCODE: -727, SQLSTATE: 56098, SQLERRMC: 2;-104;42601;END-OF-S
      TATEMENT|ect last_insert_id()|<table_expr>
      17:12:02,033 WARN [JDBCExceptionReporter] SQL Error: -727, SQLState: 56098
      17:12:02,043 ERROR [JDBCExceptionReporter] DB2 SQL error: SQLCODE: -727, SQLSTATE: 56098, SQLERRMC: 2;-104;42601;END-OF-S
      TATEMENT|ect last_insert_id()|<table_expr>
      17:12:02,043 ERROR [JDBCExceptionReporter] could not insert: [org.jboss.portal.core.impl.user.UserImpl]


      Maybe hibernate is not compatible with db2 8.2
      In the hibernate.org site, i found that db2 is compatible with 7.1, 7.2 and 8.1 (i'm using 8.2 but this is a fix of 8.1)


      THank You

        • 1. Re: DB2 8.2 Portal Setup

          did you generate the ddl for this database or use the one for mysql ?

          • 2. Re: DB2 8.2 Portal Setup

            i have regenerate DDL and sql setting db2 as target.

            In the local.properties under build dir i have set:
            portal.database=db2

            In the etc dir i create a new file named db2.properties:
            hibernate.dialect=net.sf.hibernate.dialect.DB2Dialect
            portal.datasource.driver=com.ibm.db2.jcc.DB2Driver
            portal.datasource.url=jdbc:db2:lclabs
            portal.datasource.username=user
            portal.datasource.password=psw

            now build all successful.

            But:

            the setup.ddl create is incorrect when use unique clause:

            create table jbp_users (
            jbp_uid INTEGER not null generated by default as identity,
            jbp_root_pref_set_id INTEGER unique,
            jbp_uname VARCHAR(255) unique,
            jbp_givenname VARCHAR(255),
            jbp_familyname VARCHAR(255),
            jbp_password VARCHAR(255),
            jbp_realemail VARCHAR(255),
            jbp_fakeemail VARCHAR(255),
            jbp_regdate TIMESTAMP,
            jbp_viewrealemail SMALLINT,
            jbp_enabled SMALLINT,
            primary key (jbp_uid)
            );

            but this statement is not correct for db2: a unique attribute cannot be NULL

            So i correct it using

            create table jbp_users (
            jbp_uid INTEGER not null generated by default as identity,
            jbp_root_pref_set_id INTEGER not null unique,
            jbp_uname VARCHAR(255) not null unique,
            jbp_givenname VARCHAR(255),
            jbp_familyname VARCHAR(255),
            jbp_password VARCHAR(255),
            jbp_realemail VARCHAR(255),
            jbp_fakeemail VARCHAR(255),
            jbp_regdate TIMESTAMP,
            jbp_viewrealemail SMALLINT,
            jbp_enabled SMALLINT,
            primary key (jbp_uid)
            );

            this correction is done for all attribute table that use the unique clause.

            Sql statements are not correct anyway:

            This are the generated statements:

            insert into jbp_users (jbp_uid, jbp_uname, jbp_password, jbp_realemail, jbp_regdate, jbp_viewrealemail, jbp_enabled) values ('1', 'admin', MD5('admin'), 'portal@example.com', NOW(), '1', '1');
            insert into jbp_users (jbp_uid, jbp_uname, jbp_password, jbp_realemail, jbp_regdate, jbp_viewrealemail, jbp_enabled) values ('2', 'user', MD5('user'), 'portal@example.com', NOW(), '1', '1');
            insert into jbp_roles (jbp_rid, jbp_name, jbp_displayname) values ('1', 'Admins', 'Administrators');
            insert into jbp_roles (jbp_rid, jbp_name, jbp_displayname) values ('2', 'Users', 'Users');
            insert into jbp_role_membership (jbp_uid, jbp_rid) values ('1', '1');
            insert into jbp_role_membership (jbp_uid, jbp_rid) values ('2', '2');

            but:
            MD5 and NOW function are not supported by DB2
            NOW() must be replaced by CURRENT_TIMESTAMP,
            MD5... is not supported.
            Numeric values must don't have '
            All unique attribute must be set, so for example jbp_root_pref_set_id is now not null and so the insert statement must set this column value, but for this field there is a contraint, so what is correct?
            remove the constraint, remove the unique clause, or what?