Return-Path: Delivered-To: apmail-cocoon-docs-archive@www.apache.org Received: (qmail 77889 invoked from network); 19 Sep 2003 08:00:19 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 19 Sep 2003 08:00:19 -0000 Received: (qmail 40102 invoked by uid 500); 19 Sep 2003 07:59:54 -0000 Delivered-To: apmail-cocoon-docs-archive@cocoon.apache.org Received: (qmail 40065 invoked by uid 500); 19 Sep 2003 07:59:54 -0000 Mailing-List: contact docs-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: docs@cocoon.apache.org Delivered-To: mailing list docs@cocoon.apache.org Received: (qmail 40051 invoked from network); 19 Sep 2003 07:59:54 -0000 Received: from unknown (HELO otsrv1.iic.rug.ac.be) (157.193.121.51) by daedalus.apache.org with SMTP; 19 Sep 2003 07:59:54 -0000 Received: from otsrv1.iic.ugent.be (localhost [127.0.0.1]) by otsrv1.iic.rug.ac.be (8.11.6/8.11.6) with ESMTP id h8J805X01772 for ; Fri, 19 Sep 2003 10:00:06 +0200 Date: Fri, 19 Sep 2003 10:00:06 +0200 Message-Id: <200309190800.h8J805X01772@otsrv1.iic.rug.ac.be> From: stevenn@outerthought.org To: docs@cocoon.apache.org Subject: [WIKI-UPDATE] LenyaDemo HowTos Xerces DB2V7 Fri Sep 19 10:00:05 2003 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Page: http://wiki.cocoondev.org/Wiki.jsp?page=LenyaDemo , version: 25 on Fri Sep 19 07:44:20 2003 by 194.151.195.114 + 2003.08.19: down, "Bad gateway" errors\\ Page: http://wiki.cocoondev.org/Wiki.jsp?page=HowTos , version: 128 on Fri Sep 19 07:44:09 2003 by ChristophOberle + * __[DB2 Connections|DB2V7]__ -- hints for connecting Cocoon 2 to a DB2 database -- [Christoph Oberle] + Page: http://wiki.cocoondev.org/Wiki.jsp?page=Xerces , version: 3 on Fri Sep 19 07:00:47 2003 by DavidCrossley - With cheese on it. Page: http://wiki.cocoondev.org/Wiki.jsp?page=DB2V7 , version: 1 on Fri Sep 19 07:41:10 2003 by ChristophOberle New page created: + !!! DB2 Datasources + + ---- + + To use DB2 databases in Version 7 (or above?) from Cocoon you have to complete the following + steps: + + * have DB2 support available to Cocoon + * make the JDBC driver available to Cocoon + * configure a DB2 datasource + * use the datasource from esql logicsheet or sql-transformer + + ---- + + ! DB2 support for Cocoon + + Here you have to install DB2, to catalog your databases in the database directory, to set the + environment (usually using the command db2profile), to switch to JAVA2 support (usually using + the command .../sqllib/java12/usejdbc2). + + Now you should be able to connect to a DB2 database from the command line + with a command like "db2 connect to mydatabase user myuserid". + + ---- + + ! Make the JDBC driver available to Cocoon + + If DB2 is installed correctly, then the CLASSPATH is already extended to the DB2 directories. + + Now you have to assure that your servlet server uses these classpath settings. For Tomcat + you have to modify the command .../bin/setclasspath.sh (or .bat). The default of Tomcat is + not to use the classpath settings at all! + + {{{ + # Set standard CLASSPATH + CLASSPATH=$CLASSPATH:"$JAVA_HOME"/lib/tools.jar + }}} + + Here the original classpath has been added before tools.jar + + Now add the DB2 JDBC driver to the list of preloaded classes in web.xml: + + {{{ + + load-class + + + + + org.hsqldb.jdbcDriver + + oracle.jdbc.driver.OracleDriver + COM.ibm.db2.jdbc.app.DB2Driver + + + + + }}} + + In this example the Oracle driver and the DB2 driver is added. + + ---- + + ! Configure a DB2 datasource + + To configure a DB2 datasource you have to add a jdbc element to cocoon.xconf: + + {{{ + + + + + jdbc:db2:INFO + uid + pwd + + }}} + + This example defines the datasource named "info". + + You should always set keep-alive/disable to true, because the default sends an invalid + SQL statement to the database with degrades performance! (You can find many errors "SELECT 1" in the + db2diag.log on your database server) + + If you want to have "real" transactions don't forget to set auto-commit to false! + + ---- + + !Use the datasource from esql logicsheet + + To use the datasource from a xsp serverpage with esql you use something like this: + + {{{ + + Info + false + + + + + select x, y,z + from some.table t + where x < 7 + + + + + + + + + + + + delete from some.table t + where x = 4 + + + + + + + commit + + + + + }}} + + If you don't want to have committed every single statement you have to state + autocommit=false on every esql:connection! + + ---- + + !Use the datasource from sql-transformer + + ((to be continued)) + + ---- + + and thats all! + + [Christoph Oberle] +