You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Guy Picton Phillipps <gu...@brentpct.nhs.uk> on 2004/06/21 14:36:29 UTC

RE: Problem connecting to MySQL - Solved

Problem now solved - it appears that the DB connection parameters needed to
be defined in the sitemap, not in the input XML. The answer  came from
documentation on the SQL Transformer on the Apache Cocoon site -
http://cocoon.apache.org/2.1/userdocs/transformers/sql-transformer.html

So the sitemap and XML input now read:

***************Sitemap.xmap******************
	<map:pipeline>
			<map:match pattern="sqltest">
				<map:generate src="sqlextract.xml"/>
				<map:transform type="sql">
					<map:parameter name="use-connection"
value="ward_connect"/>
					<map:parameter
name="show-nr-of-rows" value="true"/>
					<map:parameter name="clob-encoding"
value="UTF-8"/>
				</map:transform>
				<map:serialize type="xml"/>
			</map:match>
		</map:pipeline>


*************sqlextract.xml***************
 <page>
   <content>
    <execute-query xmlns="http://apache.org/cocoon/SQL/2.0"> 
     <query name="Ward Names">
         select admin_name from wards</query>
    </execute-query>
   </content>
  </page>


Whereas before they read:

**************INCORRECT sitemap.xmap*******************

	<map:pipeline>
		<map:match pattern="sqlconnect">
			<map:generate src="sqlextract.xml"/>
			<map:transform type="sql">
				<map:parameter name="use-connection"
value="ward_connect"/>
			</map:transform>
			<map:serialize type="xml"/>
		</map:match>
	</map:pipeline>


**************INCORRECT sqlextract.xml***************

<document>
	<sql:execute-query xmlns:sql="http://apache.org/cocoon/sql/2.0">
		<sql:use-connection>ward_connect</sql:use-connection>
		<sql:query>
			select admin_name from wards;
		</sql:query>
	</sql:execute-query>
</document>



Thanks to Tony for your suggestions :)

Guy


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

Kensington & Chelsea PCT
**********************************************************************


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