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="int"><xsp:expr>Integer.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]>

Reply via email to