You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by SheraX <sh...@redmath.com> on 2007/10/26 08:21:17 UTC

Inserting Special Characters in Oracle using TORQUE.

Hellow everyone, 

I am getting a strange problem. I am developing a webapplication in IBM
Rational Software Development Platform Version: 6.0.1 Using Torque Version
3.0.2. 
I need to insert special characters like (ABCDEFG1234ÑãäåæçèéêêהЦБЌ) into an
Oracle(10g) Table Column of type VARCHAR2(4000 BYTE).

The Charset of web application is default IS0-8859. The value is saved in
database and retrieved and displayed fine. But the problem arises on boundry
value checks. 
Now the string containing special characters of higher decimal ASCII value
occupy more bytes then lower ASCII value. So the length of the string is
different then the number of characters input by user.
Before inserting into database I validate the input value in the form to be
less then 4000 bytes (using myValue.length() ). It indeed shows value less
then 4000 like in one case the length of the string is 3680. But when torque
tries to insert the value in database the ORA Exception is encountered 

"org.apache.torque.TorqueException: Data size bigger than max size for this
type: 4245"


I am not able to understand why string length changes when torque tries to
insert it into the database.

Awaiting Response 


Regards

SheraX


-- 
View this message in context: http://www.nabble.com/Inserting-Special-Characters-in-Oracle-using-TORQUE.-tf4695403.html#a13421479
Sent from the Apache DB - Torque Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


RE: Inserting Special Characters in Oracle using TORQUE.

Posted by SheraX <sh...@redmath.com>.
Alright, I understand now. Thanks alot for the help.. I need to look for the
solution with least impact on the application.

Regards

Sheraz Jamshed



Thomas Fischer-11 wrote:
> 
> SheraX <sh...@redmath.com> schrieb am 26.10.2007 12:30:15:
> 
>>
>> Thanks alot for the reply Thomas.
>>
>> Regarding your solution a) how can I check the length for the character
> set
>> that Tourque Uses?
> 
> You misunderstood me. Not Torque uses a characterset, but the database
> does. Check Your database manual for how to find out the characterset of
> your database (usually this is configurable)
> 
>> For solution b) how can I change the db character set?
> 
> Again, this needs to be changed in the database. Check the db manual.
> 
>> Can we change the charset of db from any torque configuration files ?
> 
> Definitely not.
> 
>>
>> Thanks in advance...
>>
>> Sheraz Jamshed
>>
>>
>>
>>
>> Thomas Fischer-11 wrote:
>> >
>> > There are fixed length character sets (each character uses the same
> amount
>> > of space, like ISO-8859-1 (1 byte) or unicode(2 bytes)) and variable
>> > length
>> > character sets where some characters neen more space than others (e.g.
>> > utf-8 where characters can occupy 1-3 bytes). It seems that java and
> the
>> > db
>> > use different character sets. The database or its driver takes care of
> the
>> > conversion, which can lead to a longer byte sequence in the db.
>> >
>> > The solution would be a) to make the length check in the charset of the
> db
>> > or b) use the same charset in the db as in the web application.
>> >
>> >           Thomas
>> >
>> > SheraX <sh...@redmath.com> schrieb am 26.10.2007 08:21:17:
>> >
>> >>
>> >> Hellow everyone,
>> >>
>> >> I am getting a strange problem. I am developing a webapplication in
> IBM
>> >> Rational Software Development Platform Version: 6.0.1 Using Torque
>> > Version
>> >> 3.0.2.
>> >> I need to insert special characters like (ABCDEFG1234ÑãäåæçèéêêהЦБЌ)
> into
>> > an
>> >> Oracle(10g) Table Column of type VARCHAR2(4000 BYTE).
>> >>
>> >> The Charset of web application is default IS0-8859. The value is saved
> in
>> >> database and retrieved and displayed fine. But the problem arises on
>> > boundry
>> >> value checks.
>> >> Now the string containing special characters of higher decimal ASCII
>> > value
>> >> occupy more bytes then lower ASCII value. So the length of the string
> is
>> >> different then the number of characters input by user.
>> >> Before inserting into database I validate the input value in the form
> to
>> > be
>> >> less then 4000 bytes (using myValue.length() ). It indeed shows value
>> > less
>> >> then 4000 like in one case the length of the string is 3680. But when
>> > torque
>> >> tries to insert the value in database the ORA Exception is encountered
>> >>
>> >> "org.apache.torque.TorqueException: Data size bigger than max size for
>> > this
>> >> type: 4245"
>> >>
>> >>
>> >> I am not able to understand why string length changes when torque
> tries
>> > to
>> >> insert it into the database.
>> >>
>> >> Awaiting Response
>> >>
>> >>
>> >> Regards
>> >>
>> >> SheraX
>> >>
>> >>
>> >> --
>> >> View this message in context: http://www.nabble.com/Inserting-Special-
>> >> Characters-in-Oracle-using-TORQUE.-tf4695403.html#a13421479
>> >> Sent from the Apache DB - Torque Dev mailing list archive at
> Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
>> >> For additional commands, e-mail: torque-dev-help@db.apache.org
>> >>
>> >
>>
>> --
>> View this message in context: http://www.nabble.com/Inserting-Special-
>> Characters-in-Oracle-using-TORQUE.-tf4695403.html#a13424494
>> Sent from the Apache DB - Torque Dev mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
>> For additional commands, e-mail: torque-dev-help@db.apache.org
>>
> 

-- 
View this message in context: http://www.nabble.com/Inserting-Special-Characters-in-Oracle-using-TORQUE.-tf4695403.html#a13462077
Sent from the Apache DB - Torque Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


RE: Inserting Special Characters in Oracle using TORQUE.

Posted by Thomas Fischer <fi...@seitenbau.net>.
SheraX <sh...@redmath.com> schrieb am 26.10.2007 12:30:15:

>
> Thanks alot for the reply Thomas.
>
> Regarding your solution a) how can I check the length for the character
set
> that Tourque Uses?

You misunderstood me. Not Torque uses a characterset, but the database
does. Check Your database manual for how to find out the characterset of
your database (usually this is configurable)

> For solution b) how can I change the db character set?

Again, this needs to be changed in the database. Check the db manual.

> Can we change the charset of db from any torque configuration files ?

Definitely not.

>
> Thanks in advance...
>
> Sheraz Jamshed
>
>
>
>
> Thomas Fischer-11 wrote:
> >
> > There are fixed length character sets (each character uses the same
amount
> > of space, like ISO-8859-1 (1 byte) or unicode(2 bytes)) and variable
> > length
> > character sets where some characters neen more space than others (e.g.
> > utf-8 where characters can occupy 1-3 bytes). It seems that java and
the
> > db
> > use different character sets. The database or its driver takes care of
the
> > conversion, which can lead to a longer byte sequence in the db.
> >
> > The solution would be a) to make the length check in the charset of the
db
> > or b) use the same charset in the db as in the web application.
> >
> >           Thomas
> >
> > SheraX <sh...@redmath.com> schrieb am 26.10.2007 08:21:17:
> >
> >>
> >> Hellow everyone,
> >>
> >> I am getting a strange problem. I am developing a webapplication in
IBM
> >> Rational Software Development Platform Version: 6.0.1 Using Torque
> > Version
> >> 3.0.2.
> >> I need to insert special characters like (ABCDEFG1234ÑãäåæçèéêêהЦБЌ)
into
> > an
> >> Oracle(10g) Table Column of type VARCHAR2(4000 BYTE).
> >>
> >> The Charset of web application is default IS0-8859. The value is saved
in
> >> database and retrieved and displayed fine. But the problem arises on
> > boundry
> >> value checks.
> >> Now the string containing special characters of higher decimal ASCII
> > value
> >> occupy more bytes then lower ASCII value. So the length of the string
is
> >> different then the number of characters input by user.
> >> Before inserting into database I validate the input value in the form
to
> > be
> >> less then 4000 bytes (using myValue.length() ). It indeed shows value
> > less
> >> then 4000 like in one case the length of the string is 3680. But when
> > torque
> >> tries to insert the value in database the ORA Exception is encountered
> >>
> >> "org.apache.torque.TorqueException: Data size bigger than max size for
> > this
> >> type: 4245"
> >>
> >>
> >> I am not able to understand why string length changes when torque
tries
> > to
> >> insert it into the database.
> >>
> >> Awaiting Response
> >>
> >>
> >> Regards
> >>
> >> SheraX
> >>
> >>
> >> --
> >> View this message in context: http://www.nabble.com/Inserting-Special-
> >> Characters-in-Oracle-using-TORQUE.-tf4695403.html#a13421479
> >> Sent from the Apache DB - Torque Dev mailing list archive at
Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> >> For additional commands, e-mail: torque-dev-help@db.apache.org
> >>
> >
>
> --
> View this message in context: http://www.nabble.com/Inserting-Special-
> Characters-in-Oracle-using-TORQUE.-tf4695403.html#a13424494
> Sent from the Apache DB - Torque Dev mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-dev-help@db.apache.org
>

RE: Inserting Special Characters in Oracle using TORQUE.

Posted by SheraX <sh...@redmath.com>.
Thanks alot for the reply Thomas.

Regarding your solution a) how can I check the length for the character set
that Tourque Uses? 
For solution b) how can I change the db character set?

Can we change the charset of db from any torque configuration files ?

Thanks in advance...

Sheraz Jamshed




Thomas Fischer-11 wrote:
> 
> There are fixed length character sets (each character uses the same amount
> of space, like ISO-8859-1 (1 byte) or unicode(2 bytes)) and variable
> length
> character sets where some characters neen more space than others (e.g.
> utf-8 where characters can occupy 1-3 bytes). It seems that java and the
> db
> use different character sets. The database or its driver takes care of the
> conversion, which can lead to a longer byte sequence in the db.
> 
> The solution would be a) to make the length check in the charset of the db
> or b) use the same charset in the db as in the web application.
> 
>           Thomas
> 
> SheraX <sh...@redmath.com> schrieb am 26.10.2007 08:21:17:
> 
>>
>> Hellow everyone,
>>
>> I am getting a strange problem. I am developing a webapplication in IBM
>> Rational Software Development Platform Version: 6.0.1 Using Torque
> Version
>> 3.0.2.
>> I need to insert special characters like (ABCDEFG1234ÑãäåæçèéêêהЦБЌ) into
> an
>> Oracle(10g) Table Column of type VARCHAR2(4000 BYTE).
>>
>> The Charset of web application is default IS0-8859. The value is saved in
>> database and retrieved and displayed fine. But the problem arises on
> boundry
>> value checks.
>> Now the string containing special characters of higher decimal ASCII
> value
>> occupy more bytes then lower ASCII value. So the length of the string is
>> different then the number of characters input by user.
>> Before inserting into database I validate the input value in the form to
> be
>> less then 4000 bytes (using myValue.length() ). It indeed shows value
> less
>> then 4000 like in one case the length of the string is 3680. But when
> torque
>> tries to insert the value in database the ORA Exception is encountered
>>
>> "org.apache.torque.TorqueException: Data size bigger than max size for
> this
>> type: 4245"
>>
>>
>> I am not able to understand why string length changes when torque tries
> to
>> insert it into the database.
>>
>> Awaiting Response
>>
>>
>> Regards
>>
>> SheraX
>>
>>
>> --
>> View this message in context: http://www.nabble.com/Inserting-Special-
>> Characters-in-Oracle-using-TORQUE.-tf4695403.html#a13421479
>> Sent from the Apache DB - Torque Dev mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
>> For additional commands, e-mail: torque-dev-help@db.apache.org
>>
> 

-- 
View this message in context: http://www.nabble.com/Inserting-Special-Characters-in-Oracle-using-TORQUE.-tf4695403.html#a13424494
Sent from the Apache DB - Torque Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


RE: Inserting Special Characters in Oracle using TORQUE.

Posted by Thomas Fischer <fi...@seitenbau.net>.
There are fixed length character sets (each character uses the same amount
of space, like ISO-8859-1 (1 byte) or unicode(2 bytes)) and variable length
character sets where some characters neen more space than others (e.g.
utf-8 where characters can occupy 1-3 bytes). It seems that java and the db
use different character sets. The database or its driver takes care of the
conversion, which can lead to a longer byte sequence in the db.

The solution would be a) to make the length check in the charset of the db
or b) use the same charset in the db as in the web application.

          Thomas

SheraX <sh...@redmath.com> schrieb am 26.10.2007 08:21:17:

>
> Hellow everyone,
>
> I am getting a strange problem. I am developing a webapplication in IBM
> Rational Software Development Platform Version: 6.0.1 Using Torque
Version
> 3.0.2.
> I need to insert special characters like (ABCDEFG1234ÑãäåæçèéêêהЦБЌ) into
an
> Oracle(10g) Table Column of type VARCHAR2(4000 BYTE).
>
> The Charset of web application is default IS0-8859. The value is saved in
> database and retrieved and displayed fine. But the problem arises on
boundry
> value checks.
> Now the string containing special characters of higher decimal ASCII
value
> occupy more bytes then lower ASCII value. So the length of the string is
> different then the number of characters input by user.
> Before inserting into database I validate the input value in the form to
be
> less then 4000 bytes (using myValue.length() ). It indeed shows value
less
> then 4000 like in one case the length of the string is 3680. But when
torque
> tries to insert the value in database the ORA Exception is encountered
>
> "org.apache.torque.TorqueException: Data size bigger than max size for
this
> type: 4245"
>
>
> I am not able to understand why string length changes when torque tries
to
> insert it into the database.
>
> Awaiting Response
>
>
> Regards
>
> SheraX
>
>
> --
> View this message in context: http://www.nabble.com/Inserting-Special-
> Characters-in-Oracle-using-TORQUE.-tf4695403.html#a13421479
> Sent from the Apache DB - Torque Dev mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-dev-help@db.apache.org
>