RE: Problem connecting to MySQL - Solved

2004-06-21 Thread Guy Picton Phillipps
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-connectionward_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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Problem connecting to MySQL

2004-06-19 Thread Guy Picton Phillipps
Hi Tony,
Thanks for going through the details and confirming that it is OK. I did
restart Tomcat after copying the mysql.jar to the tomcat lib directory. 
I wondered if the SQL Transformer had 'broken' or I had a bad install, so I
reinstalled all the components yesterday, but to no effect.

I tried your suggestion, declaring the SQL namespace at the root tag, but
again to no effect - this is the output:

  ?xml version=1.0 encoding=ISO-8859-1 ? 
- document xmlns:sql=http://apache.org/cocoon/sql/2.0;
- sql:execute-query
  sql:use-connectionward_connect/sql:use-connection 
  sql:queryselect admin_name from wards/sql:query 
  /sql:execute-query
  /document

- which is also the input ;)

I forgot to mention that I am working on win 2K - if that makes any
difference.

If this isn't a problem with cocoon, then could it be with the MySQL
database? It is installed on Localhost:3306, but apart from start the MySQL
server running, I don't do anything else. I assume that from the connection
parameters in cocoon.xconf..

  datasources
jdbc name=ward_connect
pool-controller min=5 max=10/

dburljdbc:mysql://localhost:3306/ward_data?autoReconnect=true/dburl
useradministrator/user
passwordmypassword/password
/jdbc
  /datasources

.cocoon can find the database and connect to it? Although I read an
instruction on http://www.candlelightsoftware.com/orion-cocoon.html way down
the page under the bullet point Initialize the database using
mysql that appears to call mysql from inside cocoon? is it a
requirement for MySQL to physically sit inside Tomcat/Cocoon on the
directory? I thought that the mysql.jar would find and connect to MySql
wherever it is, as long as the connection parameters are OK.

 I have played around with the access settings to the mysql database
(setting access from all locations, from localhost only etc..), but again -
no change. In any case, If there was a problem connecting to the database
then surely cocoon would throw up a error message to that effect, but
according to the access log, there are no problems! 

So i am still stumped, but have to get this sorted soon! deadlines are
approaching fast! gulp

If you think of anything else. I will be very grateful for your help,

thanks,

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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Problem connecting to MySQL

2004-06-18 Thread Guy Picton Phillipps
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/
 
dburljdbc:mysql://localhost:3306/ward_data?autoReconnect=true/dburl
usermyusername/user
passwordmypassword/password
/jdbc
 /datasources



web.xml
init-param
param-nameload-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-connectionward_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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Problem connecting to MySQL

2004-06-18 Thread Tony Collen
Guy Picton Phillipps wrote:
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. 

snip;
Hmm, everything looks kosher. It appears the SQLTransformer is not SQLTransforming :)
You said you copied the mysql jar into the tomcat lib directory... did you restart 
Tomcat after this?
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? 
Nope, this looks OK.
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. 
Nope, the XML serializer is OK.
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.
Hmm, if the SQLTransformer is not transforming, I would think that it has something to do with your 
namespaces in the source document.

What if you try declaring the SQL namespace at the root tag:
document xmlns:sql=xmlns:sql=http://apache.org/cocoon/sql/2.0;
and then just use:
sql:execute-query
  sql:use-connectionward_connect/sql:use-connection
  sql:queryselect admin_name from wards;/sql:query
/sql:execute-query
Regards,
Tony
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Problem connecting to MySQL

2004-06-18 Thread Tony Collen
Tony Collen wrote:
document xmlns:sql=xmlns:sql=http://apache.org/cocoon/sql/2.0;
and then just use:
sql:execute-query
  sql:use-connectionward_connect/sql:use-connection
  sql:queryselect admin_name from wards;/sql:query
/sql:execute-query

Whoops, wow, my mail client *really* likes to mangle namespace declarations.  Ignore the literal 
text, and just try declaring the sql namespace in the root document tag, and see if it works.

Tony
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]