J
james.w.appleby
Hello,
I am having a problem when inputting very long strings into a database.
The application I am writing can use different databases (thanks to
the wonders of JDBC) so this issue has been causing problems on both
Oracle and SQL Server.
Because one of the design objects was to support any JDBC compatible
database, a concern was raised about text widths. It was therefore
decided that the maximum column width for a VARCHAR would be a
configurable value. We theoretically knew that data could be more than
a single line so we introduced a sequence number to allow multiple
rows. (Don't ask me why we didn't use CLOBs instead, this is the
schema I'm stuck with.)
We now need to store base64 data in the same fields. The problem is
that in an example 4000 characters as defined by the Java string
object, its physical size is approximently 4430. This seems to be
because of the amount of mark-up involved, either in the base64 data or
possibly with the text between.
It occurs to me that while a non-ASCII value many be only a single
character in a unicode string, it is 6 characters in UTF-8. Therefore
I'm looking for a way of calculates the absolute length, rather than a
count of characters.
Is this possible or will I have to change the schema?
I am having a problem when inputting very long strings into a database.
The application I am writing can use different databases (thanks to
the wonders of JDBC) so this issue has been causing problems on both
Oracle and SQL Server.
Because one of the design objects was to support any JDBC compatible
database, a concern was raised about text widths. It was therefore
decided that the maximum column width for a VARCHAR would be a
configurable value. We theoretically knew that data could be more than
a single line so we introduced a sequence number to allow multiple
rows. (Don't ask me why we didn't use CLOBs instead, this is the
schema I'm stuck with.)
We now need to store base64 data in the same fields. The problem is
that in an example 4000 characters as defined by the Java string
object, its physical size is approximently 4430. This seems to be
because of the amount of mark-up involved, either in the base64 data or
possibly with the text between.
It occurs to me that while a non-ASCII value many be only a single
character in a unicode string, it is 6 characters in UTF-8. Therefore
I'm looking for a way of calculates the absolute length, rather than a
count of characters.
Is this possible or will I have to change the schema?