cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guy Picton Phillipps <guy.picton-philli...@brentpct.nhs.uk>
Subject Problem connecting to MySQL
Date Fri, 18 Jun 2004 17:39:41 GMT
Dear Listers,
I am a newbie with Apache Cocoon and am trying my hand connecting to a MySQL
database, with some difficulty. I have researched alot and still cannot find
the answer to this problem. 

First the background info: 

Cocoon 2.1.5
Tomcat 5.0.27
mysql-3.23.38
j2sdk1.4.2_04
mysql-connector-java-3.0.11-stable-bin.jar

I have adjusted the following files to setup a database connection to MySQL:

***********cocoon.xconf**********
 <datasources>
  		<jdbc name="ward_connect">
  			<pool-controller min="5" max="10"/>
 
<dburl>jdbc:mysql://localhost:3306/ward_data?autoReconnect=true</dburl>
  			<user>myusername</user>
  			<password>mypassword</password>
  		</jdbc>
 </datasources>



************web.xml****************
<init-param>
	<param-name>load-class</param-name>
	<param-value>
		<!--For SQL Database Driver-->
        		com.mysql.jdbc.Driver
	</param-value>
</init-param>



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

	<map:pipelines>
		<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>
	</map:pipelines>


......and am using this xml file to describe the SQL query and also to
describe the connection parameters again:

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

<?xml version="1.0" encoding="UTF-8"?>
<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>


I have copied the mysql-connector-java-3.0.11-stable-bin.jar file to the
C:\jakarta-tomcat-5.0.27\common\lib and set up the JAVA SDK as per
instructions

BUT when I try and view http://localhost:8080/cocoon-test/sqlconnect in my
browser, all I get is an xml replication of the sqlextract.xml document and
when I check the Access Log file, there is a message as per the following:

**************************************************************************
INFO    (2004-06-18) 18:14.38:062   [access] (Unknown-URI)
Unknown-thread/CocoonServlet: Reloading from:
jndi:/localhost/cocoon-test/WEB-INF/cocoon.xconf
INFO    (2004-06-18) 18:15.45:500   [access] (/cocoon-test/sqlconnect)
http-8080-Processor25/CocoonServlet: 'sqlconnect' Processed by Apache Cocoon
2.1.5 in 1.969 seconds.
**************************************************************************

The output is not what I was expecting, which should be a list of names - is
there a problem with the way I have set up the database connection? Do I
need to add a different serializer to view the output? I was under the
impression that the XML serializer would deliver the raw SQL data to the
browser. The SQL Query "select admin_name from wards" works from the MySQL
prompt. 

Any help will be greatly appreciated as I have no idea why this is
happening.....

cheers,

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


Mime
View raw message