I've gotten XWiki to work with DB2, but haven't had a chance yet to post it. You need to do the following:

1) Update hibernate.cfg.xml by commenting out the MySQL configuration and replacing it with this:

    <property name="hibernate.connection.driver_class">com.ibm.db2.jcc.DB2Driver</property>
    <property name="hibernate.connection.url">jdbc:db2:xwiki</property>
    <property name="hibernate.connection.username">xwiki</property>
    <property name="hibernate.connection.password">xwiki</property>
    <property name="hibernate.dialect">org.hibernate.dialect.DB2Dialect</property>

2) Specify your own mapping file, for example like this (replace the existing xwiki.hbm.xml reference)

    <mapping resource="xwiki.hbm.db2.xml"/>

Note that you're right; one of the main problems is with the max size of the VARCHAR. There are also some other problems, such as TEXT not valid (I think). In any case, all the problems are fixed.

3) Update your jar file by putting the attached xwiki.hbm.db2.xml in xwiki.jar

4) Copy db2jcc.jar and db2jcc_license_cu.jar into your xwiki lib directory

That should do it. If the attach didn't work, let me know and I can send it .... or I suppose I should really just post these instructions to the wiki ;-)  But first, let me know if it works.

shawn.

"Brian J. Sayatovic" <trin-xwiki-users@trinition.org> wrote on 04/03/2007 08:53:49 PM:

> I've made some progress with this issue.
>
> First, I found that by editing the WEB-INF/hibernate.cfg.xml file to add
> the following Hibernate session-factory property, the schema is now created:
>
>     <property name="hibernate.hbm2ddl.auto">create</property>  
>
> Second, I found the log file TomCat was spitting out for my XWiki (in
> the wrong location... TomCat logging still befuddles me) where I found
> this (and many similar lines for other columns):
>
> 21:12:38,687 [http-80-Processor25] ERROR hbm2ddl.SchemaExport            
> - Unsuccessful: create table XWIKI.xwikiattachment_archive (XWA_ID
> bigint not null, XWA_ARCHIVE varchar(4000000) for bit data, primary key
> (XWA_ID))
> 21:12:38,687 [http-80-Processor25] ERROR hbm2ddl.SchemaExport            
> - The length, precision, or scale attribute for column, or type mapping
> 'VARCHAR (4000000) FOR BIT DATA' is not valid.
>
> Some further Googling led me to issue HHH-1501 in Hibernate JIRA that I
> think may be related where the Derby (and DB2) dialects in Hibernate
> don't correctly register that they can't handle text greater than 32k
> via VARCHAR.
>
> http://opensource.atlassian.com/projects/hibernate/browse/HHH-1501
>
> I've added a comment to that defect mentioning the potential problem
> this causes with XWiki.
>
> In the mean time, I plan to try the *.sql file for Derby from the old
> XWiki site:
>
> http://old.xwiki.org/xwiki/bin/view/AdminGuide/Apache+Derby (not
> responding???)
> http://www.google.com/search?q=cache:D-SWhm_P5W8J:old.xwiki.
> org/xwiki/bin/view/AdminGuide/Apache%
> 2BDerby+hibernate+derby+clob&hl=en&ct=clnk&cd=11&gl=us
>
> Regards,
> Brian.
>
>
>
> --
> You receive this message as a subscriber of the xwiki-
> users@objectweb.org mailing list.
> To unsubscribe: mailto:xwiki-users-unsubscribe@objectweb.org
> For general help: mailto:sympa@objectweb.org?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws