SUMMARY: Re: Problems with Database Tutorial

2002-07-09 Thread Bobby Mitchell



Christian Haul wrote:

 On 02.Jul.2002 -- 11:36 AM, Bobby Mitchell wrote:
 
While using Sybase I had to remove the esql:parameter begin and end 
tags in order to actually edit the entry, otherwise I get an sql error 
stating that SELECT name, department_id FROM employee WHERE id = ?  is 
an error. The id is being passed as a ? so it causes an error. When 
using Hsqldb I made no changes to the code.


This behaviour is the same as before. Here is the error message:


org.apache.cocoon.ProcessingException: Exception in 
ServerPagesGenerator.generate(): java.lang.RuntimeException: Error 
executing statement: SELECT name, department_id FROM employee WHERE id = 
? : com.sybase.jdbc2.jdbc.SybSQLException: Implicit conversion from 
datatype 'CHAR' to 'INT' is not allowed. Use the CONVERT function to run 
this query.

 
 Yep, error message says it all. The example is attempting to use a
 String to set an int column. It looks like HSQLDB is more forgiving in
 this. Change it to
 
 esql:query
   SELECT name, department_id FROM employee
   WHERE id = esql:parameter 
type=intxsp:exprInteger.parseInt(xsp-request:get-parameter name=id 
default=0/)/xsp:expr/esql:parameter
 /esql:query
 
 and convert the string explicitly to an integer. I've set a default of
 0 in case the parameter is non-existent to prevent a NPE or
 NumberFormatException. 
 
 It would be great if you could go through the tutorial and look for
 other, similar changes, that would be required to run it e.g. on
 sybase and file a bug in bugzilla with patches.
 
   Chris.


I applied the changes and everything works fine. I am including a patch 
file and I will also file a report on bugzilla. Thanks for the help.

patch file for the directory cocoon/tutorial/docs:
**
diff -Naur tutorial/docs/edit-dept.xsp tutorial/docs.sybase/edit-dept.xsp
--- tutorial/docs/edit-dept.xsp  Tue Jul  9 09:50:57 2002
+++ tutorial/docs.sybase/edit-dept.xsp Tue Jul  9 09:47:56 2002
@@ -24,7 +24,7 @@
  esql:execute-query
esql:query
  SELECT name FROM department
-WHERE id = esql:parameterxsp-request:get-parameter 
name=id//esql:parameter
+   WHERE id = esql:parameter 
type=intxsp:exprInteger.parseInt(xsp-request:get-parameter 
name=id default=0/)/xsp:expr/esql:parameter
/esql:query
esql:results
  esql:row-results
diff -Naur tutorial/docs/edit-empl.xsp tutorial/docs.sybase/edit-empl.xsp
--- tutorial/docs/edit-empl.xsp  Tue Jul  9 09:50:57 2002
+++ tutorial/docs.sybase/edit-empl.xsp Tue Jul  9 09:54:39 2002
@@ -23,7 +23,7 @@
esql:execute-query
  esql:query
SELECT name, department_id FROM employee
-  WHERE id = esql:parameterxsp-request:get-parameter 
name=id//esql:parameter
+ WHERE id = esql:parameter 
type=intxsp:exprInteger.parseInt(xsp-request:get-parameter 
name=id default=0/)/xsp:expr/esql:parameter
  /esql:query
  esql:results
esql:row-results
***


 
 Please follow up summarizing your problem and which suggested solution
 / information worked for you when you consider your problem
 solved. Add SUMMARY:  to the subject line. This will make FAQ
 generation and searching the list easier. In addition, it makes
 helping you more fun. Thank you.
 
 


-- 
Robert J. (Bobby) Mitchell
Systems Administrator
NASA Institute for Advanced Concepts
555A 14th St Atlanta, Ga. 30318
Phone: (404)347-9633 Fax: (404)347-9638



-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

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




Re: SUMMARY: Re: Problems with Database Tutorial

2002-07-09 Thread Bobby Mitchell

Bad patch file

Bobby Mitchell wrote:

 
 
 Christian Haul wrote:
 
 On 02.Jul.2002 -- 11:36 AM, Bobby Mitchell wrote:

 While using Sybase I had to remove the esql:parameter begin and 
 end tags in order to actually edit the entry, otherwise I get an 
 sql error stating that SELECT name, department_id FROM employee 
 WHERE id = ?  is an error. The id is being passed as a ? so it 
 causes an error. When using Hsqldb I made no changes to the code.


 This behaviour is the same as before. Here is the error message:


 org.apache.cocoon.ProcessingException: Exception in 
 ServerPagesGenerator.generate(): java.lang.RuntimeException: Error 
 executing statement: SELECT name, department_id FROM employee WHERE 
 id = ? : com.sybase.jdbc2.jdbc.SybSQLException: Implicit conversion 
 from datatype 'CHAR' to 'INT' is not allowed. Use the CONVERT 
 function to run this query.


 Yep, error message says it all. The example is attempting to use a
 String to set an int column. It looks like HSQLDB is more forgiving in
 this. Change it to

 esql:query
   SELECT name, department_id FROM employee
   WHERE id = esql:parameter 
 type=intxsp:exprInteger.parseInt(xsp-request:get-parameter 
 name=id default=0/)/xsp:expr/esql:parameter
 /esql:query

 and convert the string explicitly to an integer. I've set a default of
 0 in case the parameter is non-existent to prevent a NPE or
 NumberFormatException.
 It would be great if you could go through the tutorial and look for
 other, similar changes, that would be required to run it e.g. on
 sybase and file a bug in bugzilla with patches.

 Chris.
 
 
 
 I applied the changes and everything works fine. I am including a patch 
 file and I will also file a report on bugzilla. Thanks for the help.
 
 patch file for the directory cocoon/tutorial/docs:
 **
 diff -Naur tutorial/docs/edit-dept.xsp tutorial/docs.sybase/edit-dept.xsp
 --- tutorial/docs/edit-dept.xsp  Tue Jul  9 09:50:57 2002
 +++ tutorial/docs.sybase/edit-dept.xsp Tue Jul  9 09:47:56 2002
 @@ -24,7 +24,7 @@
  esql:execute-query
esql:query
  SELECT name FROM department
 -WHERE id = esql:parameterxsp-request:get-parameter 
 name=id//esql:parameter
 +   WHERE id = esql:parameter 
 type=intxsp:exprInteger.parseInt(xsp-request:get-parameter 
 name=id default=0/)/xsp:expr/esql:parameter
/esql:query
esql:results
  esql:row-results
 diff -Naur tutorial/docs/edit-empl.xsp tutorial/docs.sybase/edit-empl.xsp
 --- tutorial/docs/edit-empl.xsp  Tue Jul  9 09:50:57 2002
 +++ tutorial/docs.sybase/edit-empl.xsp Tue Jul  9 09:54:39 2002
 @@ -23,7 +23,7 @@
esql:execute-query
  esql:query
SELECT name, department_id FROM employee
 -  WHERE id = esql:parameterxsp-request:get-parameter 
 name=id//esql:parameter
 + WHERE id = esql:parameter 
 type=intxsp:exprInteger.parseInt(xsp-request:get-parameter 
 name=id default=0/)/xsp:expr/esql:parameter
  /esql:query
  esql:results
esql:row-results
 ***

Here's another:
Cut and paste the following patch into a file.
cd to the directory cocoon/tutorial and execute
patch -p0  patchfile
***
diff -Naur docs/edit-dept.xsp docs.sybase/edit-dept.xsp
--- docs/edit-dept.xsp  Tue Jul  9 19:53:18 2002
+++ docs.sybase/edit-dept.xsp Tue Jul  9 19:50:37 2002
@@ -24,7 +24,7 @@
  esql:execute-query
esql:query
  SELECT name FROM department
-WHERE id = esql:parameterxsp-request:get-parameter 
name=id//esql:parameter
+   WHERE id = esql:parameter 
type=intxsp:exprInteger.parseInt(xsp-request:get-parameter 
name=id default=0/)/xsp:expr/esql:parameter
/esql:query
esql:results
  esql:row-results
diff -Naur docs/edit-empl.xsp docs.sybase/edit-empl.xsp
--- docs/edit-empl.xsp  Tue Jul  9 19:53:18 2002
+++ docs.sybase/edit-empl.xsp Tue Jul  9 19:50:19 2002
@@ -23,7 +23,7 @@
esql:execute-query
  esql:query
SELECT name, department_id FROM employee
-  WHERE id = esql:parameterxsp-request:get-parameter 
name=id//esql:parameter
+ WHERE id = esql:parameter 
type=intxsp:exprInteger.parseInt(xsp-request:get-parameter 
name=id default=0/)/xsp:expr/esql:parameter
  /esql:query
  esql:results
esql:row-results
***







 
 

 Please follow up summarizing your problem and which suggested solution
 / information worked for you when you consider your problem
 solved. 

Re: Problems with Database Tutorial

2002-07-04 Thread Christian Haul

On 02.Jul.2002 -- 11:36 AM, Bobby Mitchell wrote:
 While using Sybase I had to remove the esql:parameter begin and end 
 tags in order to actually edit the entry, otherwise I get an sql error 
 stating that SELECT name, department_id FROM employee WHERE id = ?  is 
 an error. The id is being passed as a ? so it causes an error. When 
 using Hsqldb I made no changes to the code.
 
 This behaviour is the same as before. Here is the error message:
 
 
 org.apache.cocoon.ProcessingException: Exception in 
 ServerPagesGenerator.generate(): java.lang.RuntimeException: Error 
 executing statement: SELECT name, department_id FROM employee WHERE id = 
 ? : com.sybase.jdbc2.jdbc.SybSQLException: Implicit conversion from 
 datatype 'CHAR' to 'INT' is not allowed. Use the CONVERT function to run 
 this query.

Yep, error message says it all. The example is attempting to use a
String to set an int column. It looks like HSQLDB is more forgiving in
this. Change it to

esql:query
  SELECT name, department_id FROM employee
  WHERE id = esql:parameter 
type=intxsp:exprInteger.parseInt(xsp-request:get-parameter name=id 
default=0/)/xsp:expr/esql:parameter
/esql:query

and convert the string explicitly to an integer. I've set a default of
0 in case the parameter is non-existent to prevent a NPE or
NumberFormatException. 

It would be great if you could go through the tutorial and look for
other, similar changes, that would be required to run it e.g. on
sybase and file a bug in bugzilla with patches.

Chris.

Please follow up summarizing your problem and which suggested solution
/ information worked for you when you consider your problem
solved. Add SUMMARY:  to the subject line. This will make FAQ
generation and searching the list easier. In addition, it makes
helping you more fun. Thank you.

-- 
C h r i s t i a n   H a u l
[EMAIL PROTECTED]
fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08


-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

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




Re: Problems with Database Tutorial

2002-07-03 Thread Bobby Mitchell

Christian Haul wrote:

On 28.Jun.2002 -- 09:19 AM, Bobby Mitchell wrote:

I'm using Cocoon 2.1-dev, IBM JDK 1.3, running on RedHat 7.2, and using 
Sybase 11.9.2.

Now I'm using Cocoon 2.0.3-dev, Sun J2SDK 1.4.0, Tomcat 4.0.2.



I can't add or update users in the DB. I can only delete them. I tried 
this with both Sybase and Hsqldb and the results are the same.


AFAIK there's a pending bug that the treeprocssor (which interpretes
the sitemap for 2.1-dev per default) does not allow to nest actions in
an action-set. Hence using db-add inside form-val does not work with
that release and the tutorial is broken.

With 2.0.2 and 2.0.3 (not released, yet, available from CVS, branch
cocoon_2_0_3_branch) it should work.


I cownloaded 2.0.3 from cvs using the installation documentation. I had 
to make the following changes (unix):

   1. Enter cvs -d :pserver:[EMAIL PROTECTED]:/home/cvspublic -z3
  checkout -r HEAD xml-cocoon2. This will create a directory called
  xml-cocoon2 where the Cocoon2 source will be stored.


  to

   1. Enter cvs -d :pserver:[EMAIL PROTECTED]:/home/cvspublic -z3
  checkout -r cocoon_2_0_3_branch xml-cocoon2. This will create a
  directory called xml-cocoon2 where the Cocoon2 source will be
  stored.


All of the database functions work properly, but ...


While using Sybase I had to remove the esql:parameter begin and end 
tags in order to actually edit the entry, otherwise I get an sql error 
stating that SELECT name, department_id FROM employee WHERE id = ?  is 
an error. The id is being passed as a ? so it causes an error. When 
using Hsqldb I made no changes to the code.

This behaviour is the same as before. Here is the error message:


org.apache.cocoon.ProcessingException: Exception in 
ServerPagesGenerator.generate(): java.lang.RuntimeException: Error 
executing statement: SELECT name, department_id FROM employee WHERE id = 
? : com.sybase.jdbc2.jdbc.SybSQLException: Implicit conversion from 
datatype 'CHAR' to 'INT' is not allowed. Use the CONVERT function to run 
this query.

Original exception : java.lang.RuntimeException: Error executing 
statement: SELECT name, department_id FROM employee WHERE id = ? : 
com.sybase.jdbc2.jdbc.SybSQLException: Implicit conversion from datatype 
'CHAR' to 'INT' is not allowed. Use the CONVERT function to run this 
query. at 
org.apache.cocoon.www.tutorial.docs.edit_empl_xsp.generate(/var/tomcat4/work/localhost/cocoon/cocoon-files/org/apache/cocoon/www/tutorial/docs/edit_empl_xsp.java:991)
 
at 
org.apache.cocoon.generation.ServerPagesGenerator.generate(ServerPagesGenerator.java:258)
 
at 
org.apache.cocoon.components.pipeline.CachingEventPipeline.process(CachingEventPipeline.java:250)
 
at 
org.apache.cocoon.components.pipeline.CachingStreamPipeline.process(CachingStreamPipeline.java:399)
 
at 
org.apache.cocoon.www.tutorial.sitemap_xmap.matchN100BC(/var/tomcat4/work/localhost/cocoon/cocoon-files/org/apache/cocoon/www/tutorial/sitemap_xmap.java:1271)
 
at 
org.apache.cocoon.www.tutorial.sitemap_xmap.process(/var/tomcat4/work/localhost/cocoon/cocoon-files/org/apache/cocoon/www/tutorial/sitemap_xmap.java:757)
 
at 
org.apache.cocoon.www.tutorial.sitemap_xmap.process(/var/tomcat4/work/localhost/cocoon/cocoon-files/org/apache/cocoon/www/tutorial/sitemap_xmap.java:684)
 
at org.apache.cocoon.sitemap.Handler.process(Handler.java:224) at 
org.apache.cocoon.sitemap.Manager.invoke(Manager.java:179) at 
org.apache.cocoon.www.sitemap_xmap.matchN102F1(/var/tomcat4/work/localhost/cocoon/cocoon-files/org/apache/cocoon/www/sitemap_xmap.java:3411)
 
at 
org.apache.cocoon.www.sitemap_xmap.process(/var/tomcat4/work/localhost/cocoon/cocoon-files/org/apache/cocoon/www/sitemap_xmap.java:2640)
 
at 
org.apache.cocoon.www.sitemap_xmap.process(/var/tomcat4/work/localhost/cocoon/cocoon-files/org/apache/cocoon/www/sitemap_xmap.java:2538)
 
at org.apache.cocoon.sitemap.Handler.process(Handler.java:224) at 
org.apache.cocoon.sitemap.Manager.invoke(Manager.java:179) at 
org.apache.cocoon.sitemap.SitemapManager.process(SitemapManager.java:154) 
at org.apache.cocoon.Cocoon.process(Cocoon.java:575) at 
org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:999) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java) at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
 
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
 
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243) 
at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) 
at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) 
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) 
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190) 
at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) 
at 

Problems with Database Tutorial

2002-07-01 Thread Bobby Mitchell

I'm using Cocoon 2.1-dev, IBM JDK 1.3, running on RedHat 7.2, and using 
Sybase 11.9.2.

I can't add or update users in the DB. I can only delete them. I tried 
this with both Sybase and Hsqldb and the results are the same.

While using Sybase I had to remove the esql:parameter begin and end 
tags in order to actually edit the entry, otherwise I get an sql error 
stating that SELECT name, department_id FROM employee WHERE id = ?  is 
an error. The id is being passed as a ? so it causes an error. When 
using Hsqldb I made no changes to the code.


Has anyone ever seen this before? Where do I look in the log files for 
debug info, such as tracking what is taking place behind the scenes? Are 
there debug parameters that I can pass to Cocoon and receive more debug 
info.

I'm new to Cocoon, but from what I see so far I like it. I have been 
somewhat at a loss when reading through the docs and I certainly 
understand the comments on the list regarding documentation.

My wish list:
A debug feature that outlines each move Cocoon makes, so I can trace 
what my code is producing and more importantly where it fails.

-- 
Robert J. (Bobby) Mitchell
Systems Administrator
NASA Institute for Advanced Concepts
555A 14th St Atlanta, Ga. 30318
Phone: (404)347-9633 Fax: (404)347-9638




-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

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




Re: Problems with Database Tutorial

2002-07-01 Thread Christian Haul

On 28.Jun.2002 -- 09:19 AM, Bobby Mitchell wrote:
 I'm using Cocoon 2.1-dev, IBM JDK 1.3, running on RedHat 7.2, and using 
 Sybase 11.9.2.
 
 I can't add or update users in the DB. I can only delete them. I tried 
 this with both Sybase and Hsqldb and the results are the same.

AFAIK there's a pending bug that the treeprocssor (which interpretes
the sitemap for 2.1-dev per default) does not allow to nest actions in
an action-set. Hence using db-add inside form-val does not work with
that release and the tutorial is broken.

With 2.0.2 and 2.0.3 (not released, yet, available from CVS, branch
cocoon_2_0_3_branch) it should work.

 While using Sybase I had to remove the esql:parameter begin and end 
 tags in order to actually edit the entry, otherwise I get an sql error 
 stating that SELECT name, department_id FROM employee WHERE id = ?  is 
 an error. The id is being passed as a ? so it causes an error. When 
 using Hsqldb I made no changes to the code.

This is standard JDBC syntax for a prepared statement that takes
parameters. Maybe the original error message provides more information?

 Has anyone ever seen this before? Where do I look in the log files for 
 debug info, such as tracking what is taking place behind the scenes? Are 
 there debug parameters that I can pass to Cocoon and receive more debug 
 info.

That is spread among several files. Most interesting are probably
core.log and sitemap.log. This can be configured in logkit.xconf.

 My wish list:
A debug feature that outlines each move Cocoon makes, so I can trace 
 what my code is producing and more importantly where it fails.

The java code produced from an XSP is located
$TOMCAT/work/Standalone/localhost/cocoon/cocoon-files/org/apache/cocoon/path/relative/to/context/name_xsp.java
 

It often helps a lot to have a look at it.

Chris.

Please follow up summarizing your problem and which suggested solution /
information worked for you. Add SUMMARY:  to the subject line. This
will make FAQ generation and searching the list easier. In addition,
it makes helping you more fun. Thank you.

-- 
C h r i s t i a n   H a u l
[EMAIL PROTECTED]
fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08


-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

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