You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by beyaRecords - The home Urban music <uz...@beya-records.com> on 2003/12/28 12:18:18 UTC

database issuses - (cocoon + mysql)

Hi,
I am having an issue connecting to a MySQL database. Basically, any 
esql tags with data between them is being written to the screen instead 
of being processed and no connection to the database is being made. For 
example instead of <esql:pool>mysql</esql:pool> being processed, 
'mysql' is being printed to the screen. What am i not doing correctly? 
The process I followed to try and ensure database connectivity was 
this:

1. Copy JDBC driver for MySQL into CATALINA_HOME/common/lib
2. Define a MySQL datasource:

<datasources>
     <jdbc logger="core.datasources.mysql" name="mysql">
       <pool-controller max="10" min="5"/>
       <auto-commit>false</auto-commit>
       <dburl>jdbc:mysql://localhost/test</dburl>
       <user>user</user>
       <password>password</password>
     </jdbc>
</datasources>

3. edit CATALINA_HOME/webapps/cocoon/web-inf/web.xml
     <init-param>
       <param-name>load-class</param-name>
       <param-value>
       	<!-- MySQL -->
       	 org.gjt.mm.mysql.Driver
       	
       	<!-- PostgreSQL -->
       	org.postgresql.Driver

       </param-value>
     </init-param>

4. xsp code:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsp:page language="java" xmlns:xsp="http://apache.org/xsp" 
xmlns:esql="htp://apache.org/cocoon/SQL/v2" 
xmlns:xsp-session="http://apache.org/xsp/session/2.0">
<page>
	<title>trouble tickets</title>
	<content>
		<esql:connection>
			<esql:pool>mysql</esql:pool>
				<esql:execute-query>
					<esql:query>select * from TroubleTickets</esql:query>
						<esql:results>
							<tickets>
								<esql:row-results>
									<ticket>
										<esql:get-columns/>
									</ticket>
								</esql:row-results>
							</tickets>
						</esql:results>
						<esql:no-results>
        						<p>Sorry, no results!</p>
     					</esql:no-results>
				</esql:execute-query>
		</esql:connection>
	</content>
</page>
</xsp:page>

5. xsl snippet:

		<xsl:template  match="tickets">
			<table border="1"  width="100%">
				<xsl:apply-templates/>
			</table>
		</xsl:template>
		
		<xsl:template match="ticket">
			<tr>
				<xsl:for-each select="*">
					<td><xsl:apply-templates/></td>
				</xsl:for-each>
			</tr>
		</xsl:template>

regards


Uzo
On 28 Dec 2003, at 10:40, Luca Morandini wrote:

> joakim verona wrote:
>> So I guess my basic question is: how do I make a pipeline that can 
>> take both request parameters and
>> "bizdata" parameters at the same time? Or is it the other way around? 
>> Should the pipeline
>> be made to accept "bizdata" parameters only?
>
> Well, let's put it this way: if I had to send two parameters ("x" and 
> "y") to pipeline "foo.xml", I'd do the following ("os" being the 
> pipeline's output and "x" and "y2 the Javascript variables holding 
> request parameters' values):
>
> cocoon.processPipelineTo('foo.xml', {'x' : x, 'y' : y}, os);
>
> Regards,
>
> -----------------------------------
> Luca Morandini   -   GIS Consultant
> lmorandini@ieee.org
> http://xoomer.virgilio.it/ukmorand/
> -----------------------------------
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org