cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Haul <>
Subject Re: Problems with Database Tutorial
Date Thu, 04 Jul 2002 07:53:05 GMT
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

              SELECT name, department_id FROM employee
              WHERE id = <esql:parameter type="int"><xsp:expr>Integer.parseInt(<xsp-request:get-parameter
name="id" default="0"/>)</xsp:expr></esql:parameter>

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

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.


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
    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.     <>

To unsubscribe, e-mail:     <>
For additional commands, e-mail:   <>

View raw message