You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Antonio Gallardo Rivera <ag...@agsoftware.dnsalias.com> on 2002/08/28 22:36:49 UTC
How to code the boolean datatype in a descriptor?
I am using cocoon to let the users fill a database.
I am using Cocoon 2.03, Tomcat 4.1.9 and Java 1.4.1 on Linux.
I wrote the following descriptor:
<root>
<parameter name="id" nullable="no" type="long" default="1"/>
<parameter name="nombre" nullable="no" max-len="50" min-len="3"
type="string"/>
<parameter name="habilitado" nullable="no" min="0" max="1" type="long"/>
<constraint-set name="update">
<validate name="id"/>
<validate name="nombre"/>
<validate name="habilitado"/>
</constraint-set>
<constraint-set name="add">
<validate name="nombre"/>
<validate name="habilitado" default="1"/>
</constraint-set>
<connection>mp_pool</connection>
<table name="categoria">
<keys>
<key dbcol="cat_id" mode="manual" param="id" type="int"/>
</keys>
<values>
<value dbcol="cat_nombre" param="nombre" type="string"/>
<value dbcol="cat_habilitado" param="habilitado" type="boolean"/>
</values>
</table>
</root>
Cocoon give me and error in the line:
<value dbcol="cat_habilitado" param="habilitado" type="boolean"/>
Then how I can code a boolean value to store and retrieve it from ProstgreSQL
7.2.1?
The error I got is:
"Can't set column because the type boolean is unrecognized"
Detail:
Original exception : java.sql.SQLException: Can't set column because the type
boolean is unrecognized at
org.apache.cocoon.acting.AbstractDatabaseAction.setColumn(AbstractDatabaseAction.java:415)
at
org.apache.cocoon.acting.AbstractDatabaseAction.setColumn(AbstractDatabaseAction.java:393)
at
org.apache.cocoon.acting.AbstractDatabaseAction.setColumn(AbstractDatabaseAction.java:379)
at
org.apache.cocoon.acting.AbstractDatabaseAction.setColumn(AbstractDatabaseAction.java:355)
at
org.apache.cocoon.acting.DatabaseAddAction.processTable(DatabaseAddAction.java:221)
at org.apache.cocoon.acting.DatabaseAddAction.act(DatabaseAddAction.java:117)
at
....
---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: [SUMMARY] How to encode ISO-8859-1 characters into the Database?
Posted by Barbara Post <ba...@ifrance.com>.
I guess Carsten helped me finding this out first ;-)
So thanks to every guru here :-)
Cocoon rules ;-)
----- Original Message -----
From: "Antonio Gallardo Rivera" <ag...@agsoftware.dnsalias.com>
To: <co...@xml.apache.org>
Sent: Thursday, August 29, 2002 11:25 AM
Subject: [SUMMARY] How to encode ISO-8859-1 characters into the Database?
Barbara:
Thank you Very much! It works fine now!
Antonio Gallardo
*********************************************************************
SOLUTION by Barbara Post :) :
go to the sitemap and ensure that XML and HTML serializers have the
following
tag:
<encoding>iso-8859-1</encoding>
*********************************************************************
CAUSE by Barbara Post:
Sitemap overrides XSP/XSL encoding....
*********************************************************************
PROBLEM by me :(
I create the Database now using the following string:
createdb -E LATIN1 -e mydb
Where,
LATIN1 is the encoding used by the database
mydb is the name of the database
Now When I wrote: "Olé"
When I retrieve the values there are: "Olé"
Also, I used at the beginning of the XSP pages the string:
<?xml version="1.0" encoding="ISO-8859-1"?>
What is wrong?
*********************************************************************
The first request:
PLATAFORM:
Cocoon 2.0.3
Tomcat 4.1.9
PostgreSQL 7.2.1.
PROBLEM:
If I store a string value, like "Olé" in the Database without using Cocoon.
I
retrieve it and see "Olé". The same string.
With Cocoon:
I need to store values to the Database like "Olé". I saw that the Cocoon
manipulate the data like UTF-8 and not in the code ISO-8859-1. How I can
change this feature to make Cocoon work in ISO-8859-1 code?
I hope it will help anybody :) And thanks again Barbara :)
Antonio Gallardo
---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
[SUMMARY] How to encode ISO-8859-1 characters into the Database?
Posted by Antonio Gallardo Rivera <ag...@agsoftware.dnsalias.com>.
Barbara:
Thank you Very much! It works fine now!
Antonio Gallardo
*********************************************************************
SOLUTION by Barbara Post :) :
go to the sitemap and ensure that XML and HTML serializers have the following
tag:
<encoding>iso-8859-1</encoding>
*********************************************************************
CAUSE by Barbara Post:
Sitemap overrides XSP/XSL encoding....
*********************************************************************
PROBLEM by me :(
I create the Database now using the following string:
createdb -E LATIN1 -e mydb
Where,
LATIN1 is the encoding used by the database
mydb is the name of the database
Now When I wrote: "Olé"
When I retrieve the values there are: "Olé"
Also, I used at the beginning of the XSP pages the string:
<?xml version="1.0" encoding="ISO-8859-1"?>
What is wrong?
*********************************************************************
The first request:
PLATAFORM:
Cocoon 2.0.3
Tomcat 4.1.9
PostgreSQL 7.2.1.
PROBLEM:
If I store a string value, like "Olé" in the Database without using Cocoon. I
retrieve it and see "Olé". The same string.
With Cocoon:
I need to store values to the Database like "Olé". I saw that the Cocoon
manipulate the data like UTF-8 and not in the code ISO-8859-1. How I can
change this feature to make Cocoon work in ISO-8859-1 code?
I hope it will help anybody :) And thanks again Barbara :)
Antonio Gallardo
---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: How to encode ISO-8859-1 characters into the Database?
Posted by Barbara Post <ba...@ifrance.com>.
go to the sitemap and first ensure that XML and HTML serializers have the
following tag :
<encoding>iso-8859-1</encoding>
What other components could be configured this way ?
It solved my problem, so it may help yours, although I don't use XSP.
Sitemap overrides XSP/XSL encoding....
Barbara
----- Original Message -----
From: "Antonio Gallardo Rivera" <ag...@agsoftware.dnsalias.com>
To: <co...@xml.apache.org>
Sent: Thursday, August 29, 2002 10:45 AM
Subject: Re: How to encode ISO-8859-1 characters into the Database?
I create the Database now using the following string:
createdb -E LATIN1 -e mydb
Where,
LATIN1 is the encoding used by the database
mydb is the name of the database
Now When I wrote: "Olé"
When I retrieve the values there are: "Olé"
Please, somebody know how to resolve this problem. I used at the beginning
of
the XSP pages the string:
<?xml version="1.0" encoding="ISO-8859-1"?>
What I am doing wrong?
Regards,
Antonio Gallardo
El Jueves, 29 de Agosto de 2002 01:57, Antonio Gallardo Rivera escribió:
> I am using PostgreSQL 7.2.1
> If I store a string value, like "Olé" in the Database without using
Cocoon.
> I can get it back. Without any problem. It is stored correctly. But, In
> Cocoon 2.03 (Tomcat 4.1.9)
>
> I need to store values to the Database like "Olé". I saw that the Cocoon
> manipulate the data like UTF-8 and not in the code ISO-8859-1. How I can
> change this feature to make Cocoon work in ISO-8859-1 code?
>
> Regards,
>
> Antonio Gallardo
>
> ---------------------------------------------------------------------
> 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: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
RE: How to encode ISO-8859-1 characters into the Database?
Posted by Koen Pellegrims <ko...@pandora.be>.
> -----Oorspronkelijk bericht-----
> Van: Vadim Gritsenko [mailto:vadim.gritsenko@verizon.net]
> Verzonden: vrijdag 30 augustus 2002 16:05
> Aan: cocoon-users@xml.apache.org
> Onderwerp: Re: How to encode ISO-8859-1 characters into the Database?
>
>
> Koen Pellegrims wrote:
>
> >I don't know about Postgres, but with MySQL, you can set a
> parameter on the
> >jdbc-driver in web.xml
> >eg.:
> >
> ><jdbc name="mydb">
> > <encoding>ISO-8859-15</encoding>
> >
>
> It'd better be UTF-8. Whole XML world lives in UTF-8, and Java
> characters know nothing except UTF-8 (101 of Java char type). Thus, when
> your database returns non-UTF, of course you can do some tricks to make
> result look Ok, but this does not solve the issue.
>
> Point here is when your database, say, in ISO-8859-15, and you want
> output HTML in same encoding, then it will work. But if you ask
> serializer to use other encoding (which it can do - if input is valid),
> result will be garbage, because serializer when encoding will *assume*
> that input is UTF-8 - but it is not.
>
You're absolutely right, my bad... :-)
>
> Regards,
> Vadim
>
>
>
> > <dburl>jdbc:mysql://<server>/<db>
> ></jdbc>
> >
> >
> >
> >>-----Oorspronkelijk bericht-----
> >>Van: Antonio Gallardo Rivera [mailto:agallardo@agsoftware.dnsalias.com]
> >>Verzonden: donderdag 29 augustus 2002 10:45
> >>Aan: cocoon-users@xml.apache.org
> >>Onderwerp: Re: How to encode ISO-8859-1 characters into the Database?
> >>
> >>
> >>I create the Database now using the following string:
> >>
> >>createdb -E LATIN1 -e mydb
> >>
> >>Where,
> >>LATIN1 is the encoding used by the database
> >>mydb is the name of the database
> >>
> >>Now When I wrote: "Olé"
> >>When I retrieve the values there are: "Olé"
> >>
> >>Please, somebody know how to resolve this problem. I used at the
> >>beginning of
> >>the XSP pages the string:
> >>
> >><?xml version="1.0" encoding="ISO-8859-1"?>
> >>
> >>What I am doing wrong?
> >>
> >>Regards,
> >>
> >>Antonio Gallardo
> >>
> >>
> >>
> ...
>
>
>
> ---------------------------------------------------------------------
> 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: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>
>
---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: How to encode ISO-8859-1 characters into the Database?
Posted by Vadim Gritsenko <va...@verizon.net>.
Koen Pellegrims wrote:
>I don't know about Postgres, but with MySQL, you can set a parameter on the
>jdbc-driver in web.xml
>eg.:
>
><jdbc name="mydb">
> <encoding>ISO-8859-15</encoding>
>
It'd better be UTF-8. Whole XML world lives in UTF-8, and Java
characters know nothing except UTF-8 (101 of Java char type). Thus, when
your database returns non-UTF, of course you can do some tricks to make
result look Ok, but this does not solve the issue.
Point here is when your database, say, in ISO-8859-15, and you want
output HTML in same encoding, then it will work. But if you ask
serializer to use other encoding (which it can do - if input is valid),
result will be garbage, because serializer when encoding will *assume*
that input is UTF-8 - but it is not.
Regards,
Vadim
> <dburl>jdbc:mysql://<server>/<db>
></jdbc>
>
>
>
>>-----Oorspronkelijk bericht-----
>>Van: Antonio Gallardo Rivera [mailto:agallardo@agsoftware.dnsalias.com]
>>Verzonden: donderdag 29 augustus 2002 10:45
>>Aan: cocoon-users@xml.apache.org
>>Onderwerp: Re: How to encode ISO-8859-1 characters into the Database?
>>
>>
>>I create the Database now using the following string:
>>
>>createdb -E LATIN1 -e mydb
>>
>>Where,
>>LATIN1 is the encoding used by the database
>>mydb is the name of the database
>>
>>Now When I wrote: "Olé"
>>When I retrieve the values there are: "Olé"
>>
>>Please, somebody know how to resolve this problem. I used at the
>>beginning of
>>the XSP pages the string:
>>
>><?xml version="1.0" encoding="ISO-8859-1"?>
>>
>>What I am doing wrong?
>>
>>Regards,
>>
>>Antonio Gallardo
>>
>>
>>
...
---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
RE: How to encode ISO-8859-1 characters into the Database?
Posted by Koen Pellegrims <ko...@pandora.be>.
I don't know about Postgres, but with MySQL, you can set a parameter on the
jdbc-driver in web.xml
eg.:
<jdbc name="mydb">
<encoding>ISO-8859-15</encoding>
<dburl>jdbc:mysql://<server>/<db>
</jdbc>
> -----Oorspronkelijk bericht-----
> Van: Antonio Gallardo Rivera [mailto:agallardo@agsoftware.dnsalias.com]
> Verzonden: donderdag 29 augustus 2002 10:45
> Aan: cocoon-users@xml.apache.org
> Onderwerp: Re: How to encode ISO-8859-1 characters into the Database?
>
>
> I create the Database now using the following string:
>
> createdb -E LATIN1 -e mydb
>
> Where,
> LATIN1 is the encoding used by the database
> mydb is the name of the database
>
> Now When I wrote: "Olé"
> When I retrieve the values there are: "Olé"
>
> Please, somebody know how to resolve this problem. I used at the
> beginning of
> the XSP pages the string:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> What I am doing wrong?
>
> Regards,
>
> Antonio Gallardo
>
> El Jueves, 29 de Agosto de 2002 01:57, Antonio Gallardo Rivera escribió:
> > I am using PostgreSQL 7.2.1
> > If I store a string value, like "Olé" in the Database without
> using Cocoon.
> > I can get it back. Without any problem. It is stored correctly. But, In
> > Cocoon 2.03 (Tomcat 4.1.9)
> >
> > I need to store values to the Database like "Olé". I saw that the Cocoon
> > manipulate the data like UTF-8 and not in the code ISO-8859-1.
> How I can
> > change this feature to make Cocoon work in ISO-8859-1 code?
> >
> > Regards,
> >
> > Antonio Gallardo
> >
> > ---------------------------------------------------------------------
> > 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: <co...@xml.apache.org>
> > For additional commands, e-mail: <co...@xml.apache.org>
>
> ---------------------------------------------------------------------
> 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: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>
>
---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: How to encode ISO-8859-1 characters into the Database?
Posted by Antonio Gallardo Rivera <ag...@agsoftware.dnsalias.com>.
I create the Database now using the following string:
createdb -E LATIN1 -e mydb
Where,
LATIN1 is the encoding used by the database
mydb is the name of the database
Now When I wrote: "Olé"
When I retrieve the values there are: "Olé"
Please, somebody know how to resolve this problem. I used at the beginning of
the XSP pages the string:
<?xml version="1.0" encoding="ISO-8859-1"?>
What I am doing wrong?
Regards,
Antonio Gallardo
El Jueves, 29 de Agosto de 2002 01:57, Antonio Gallardo Rivera escribió:
> I am using PostgreSQL 7.2.1
> If I store a string value, like "Olé" in the Database without using Cocoon.
> I can get it back. Without any problem. It is stored correctly. But, In
> Cocoon 2.03 (Tomcat 4.1.9)
>
> I need to store values to the Database like "Olé". I saw that the Cocoon
> manipulate the data like UTF-8 and not in the code ISO-8859-1. How I can
> change this feature to make Cocoon work in ISO-8859-1 code?
>
> Regards,
>
> Antonio Gallardo
>
> ---------------------------------------------------------------------
> 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: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
How to encode ISO-8859-1 characters into the Database?
Posted by Antonio Gallardo Rivera <ag...@agsoftware.dnsalias.com>.
I am using PostgreSQL 7.2.1
If I store a string value, like "Olé" in the Database without using Cocoon. I
can get it back. Without any problem. It is stored correctly. But, In Cocoon
2.03 (Tomcat 4.1.9)
I need to store values to the Database like "Olé". I saw that the Cocoon
manipulate the data like UTF-8 and not in the code ISO-8859-1. How I can
change this feature to make Cocoon work in ISO-8859-1 code?
Regards,
Antonio Gallardo
---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
[Cocoon] SUMMARY: How to code the boolean datatype in a descriptor?
Posted by Antonio Gallardo Rivera <ag...@agsoftware.dnsalias.com>.
Hi:
To answer my own question. Nobody reply my question. I was researching the
Cocoon 2.0.3 source code....
The answer is: THERE IS NO A BOOLEAN DATA TYPE. I must change the DB Schema to
rebuild a new database.
Valid datatypes are ONLY (see the file "AbtractDatabaseAction.java" inside the
cocoon directory: src/java/org/apache/cocoon/acting)
Type - Description
ascii - ASCII Input Stream, a CLOB input
big-decimal - java.math.BigDecimal
binary - Binary Input Stream, a BLOB input
byte - a Byte
string - a String
date - a Date
double - a Double
float - a Float
int - an Integer
long - a Long
short - a Short
time - a Time
time-stamp - a Timestamp
now - a Timestamp with the current day/time -- the form value is ignored
image - a binary image file, we cache the attribute information
image-width -- The width attribute of the cached file attribute. NOTE: param
attribute must equal the param for image with a "-width" suffix.
image-height - The height attribute of the cached file attribute. NOTE: param
attribute must equal the param for image with a "-height" suffix.
image-size - the size attribute of the cached file attribute NOTE: param
attribute must equal the param for image with a "-size" suffix.
@version CVS $Id: AbstractDatabaseAction.java,v 1.6.2.2 2002/06/11 13:39:23
haul
-----------------------------------------------------------------------------------
After that the answer to my question is: use char or another datatype inside
your Database schema to emulate the boolean datatype.
Thanks for your help,
Regards,
Antonio Gallardo.
El Miércoles, 28 de Agosto de 2002 14:36, Antonio Gallardo Rivera escribió:
> I am using cocoon to let the users fill a database.
>
> I am using Cocoon 2.03, Tomcat 4.1.9 and Java 1.4.1 on Linux.
>
> I wrote the following descriptor:
>
> <root>
> <parameter name="id" nullable="no" type="long" default="1"/>
> <parameter name="nombre" nullable="no" max-len="50" min-len="3"
> type="string"/>
> <parameter name="habilitado" nullable="no" min="0" max="1" type="long"/>
> <constraint-set name="update">
> <validate name="id"/>
> <validate name="nombre"/>
> <validate name="habilitado"/>
> </constraint-set>
> <constraint-set name="add">
> <validate name="nombre"/>
> <validate name="habilitado" default="1"/>
> </constraint-set>
> <connection>mp_pool</connection>
> <table name="categoria">
> <keys>
> <key dbcol="cat_id" mode="manual" param="id" type="int"/>
> </keys>
> <values>
> <value dbcol="cat_nombre" param="nombre" type="string"/>
> <value dbcol="cat_habilitado" param="habilitado" type="boolean"/>
> </values>
> </table>
> </root>
>
> Cocoon give me and error in the line:
>
> <value dbcol="cat_habilitado" param="habilitado" type="boolean"/>
>
> Then how I can code a boolean value to store and retrieve it from
> ProstgreSQL 7.2.1?
>
> The error I got is:
>
> "Can't set column because the type boolean is unrecognized"
>
> Detail:
>
> Original exception : java.sql.SQLException: Can't set column because the
> type boolean is unrecognized at
> org.apache.cocoon.acting.AbstractDatabaseAction.setColumn(AbstractDatabaseA
>ction.java:415) at
> org.apache.cocoon.acting.AbstractDatabaseAction.setColumn(AbstractDatabaseA
>ction.java:393) at
> org.apache.cocoon.acting.AbstractDatabaseAction.setColumn(AbstractDatabaseA
>ction.java:379) at
> org.apache.cocoon.acting.AbstractDatabaseAction.setColumn(AbstractDatabaseA
>ction.java:355) at
> org.apache.cocoon.acting.DatabaseAddAction.processTable(DatabaseAddAction.j
>ava:221) at
> org.apache.cocoon.acting.DatabaseAddAction.act(DatabaseAddAction.java:117)
> at
> ....
>
> ---------------------------------------------------------------------
> 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: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>