You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by do...@cocoon.apache.org on 2005/01/25 10:16:19 UTC
[Cocoon Wiki] Updated: MySQL
Date: 2005-01-25T01:16:19
Editor: JeanClaudeMoissinac
Wiki: Cocoon Wiki
Page: MySQL
URL: http://wiki.apache.org/cocoon/MySQL
no comment
Change Log:
------------------------------------------------------------------------------
@@ -11,19 +11,19 @@
== Setting the web.xml configuration ==
-In the $COCOON_HOME/WEB-INF/ directory you will find the web.xml file. Open it and look for this rows {{{
-<init-param>
- <param-name>load-class</param-name>
- <param-value>
-<!--
- For IBM WebSphere:
+In the $COCOON_HOME/WEB-INF/ directory you will find the web.xml file. Open it and look for this rows {{{
+<init-param>
+ <param-name>load-class</param-name>
+ <param-value>
+<!--
+ For IBM WebSphere:
com.ibm.servlet.classloader.Handler ..-->}}}
here you have to add the following line:
-{{{
-<!-- For MySQL Driver: -->
- com.mysql.jdbc.Driver
- <!-- or use org.gjt.mm.mysql.Driver if you have the older 'Mark Matthews' driver-->
-
+{{{
+<!-- For MySQL Driver: -->
+ com.mysql.jdbc.Driver
+ <!-- or use org.gjt.mm.mysql.Driver if you have the older 'Mark Matthews' driver-->
+
}}}
== Setting the cocoon.xconf configuration ==
@@ -31,29 +31,31 @@
Search for:
{{{<datasources>}}}
add into this element these lines:
-{{{
- <jdbc name="YourPoolName">
- <pool-controller min="5" max="10"/>
- <dburl>jdbc:mysql://localhost:3306/YourDatabaseName?autoReconnect=true</dburl>
- <user>YourUsername</user>
- <password>YourPassword</password>
- </jdbc>
+{{{
+ <jdbc name="YourPoolName">
+ <pool-controller min="5" max="10"/>
+ <dburl>jdbc:mysql://localhost:3306/YourDatabaseName?autoReconnect=true</dburl>
+ <user>YourUsername</user>
+ <password>YourPassword</password>
+ </jdbc>
}}}
The ?autoReconnect=true tip is cribbed from the [http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html Tomcat JNDI datasource HOWTO ] to get around the fact that MySQL by default drops connections that have been idle for 8 hours
== Setting the sitemap.xmap configuration ==
When you want to use the connection with the SQLTransformer you just call the JDBC name inside the pipeline in this way:
-{{{
-<map:match pattern="sqlquery">
- <map:generate src="sql/sqlquery.xml"/>
- <map:transform type="sql">
- <map:parameter name="use-connection" value="YourPoolName"/>
- </map:transform>
- <map:transform type="xslt" src="../stylesheets/transformation.xslt"/>
- <map:serialize type="svg2jpeg"/>
-</map:match>
+{{{
+<map:match pattern="sqlquery">
+ <map:generate src="sql/sqlquery.xml"/>
+ <map:transform type="sql">
+ <map:parameter name="use-connection" value="YourPoolName"/>
+ </map:transform>
+ <map:transform type="xslt" src="../stylesheets/transformation.xslt"/>
+ <map:serialize type="svg2jpeg"/>
+</map:match>
}}}
Obviously you have to adapt this sample to fill your need.[[BR]]
SpecificDatabaseConnection
== Comments from the readers ==
+
+Attention: you need to have (mysql jdbc driver, saxon , jdk) working together; I'm working with JDK1.5, Saxon8, Mysql JDBC 3.06-ga