Aha, we do indeed Knut, but I just found a bug that is present at least on
10.5.3.0. If you try to create a database using the client driver with 243
[excluding ;create=true] Latin characters (e.g. 'ç'), the server will throw the
following exception:
--------------8<----------------
2010-09-13 20:26:11.052 GMT : fromIndex(518) > toIndex(275)
java.lang.IllegalArgumentException: fromIndex(518) > toIndex(275)
at java.util.Arrays.rangeCheck(Arrays.java:1306)
at java.util.Arrays.fill(Arrays.java:2567)
at org.apache.derby.impl.drda.DDMWriter.padBytes(Unknown Source)
at org.apache.derby.impl.drda.DDMWriter.writeScalarPaddedBytes(Unknown
Source)
at org.apache.derby.impl.drda.DRDAConnThread.writeRDBNAM(Unknown Source)
------------8<-----------------------
This causes havoc as probably 'ç' is indeed requiring more than one byte to be
encoded. I'm actually surprised this works at all but it's probably some
obscure
addition of EBCDIC on top of just regular US-ASCII. When I try to get the bytes
for 'ç' in plain US-ASCII, I get 63 which is ASCII for the question mark.
This means that as it is, on the client driver, the limit will be shorter than
255 characters if these special characters are used. The only matter for
concern
is that in previous releases this limit isn't properly handled and we just let
the server crash with a serious unhandled exception.
I'm all for raising this limit if the community agrees that this does not
violate the DRDA protocol. I think Kathey also expressed some concern about the
limit on JIRA, so it would be interesting to hear her thoughts on this.
Tiago
----- Original Message ----
From: Knut Anders Hatlen <[email protected]>
To: [email protected]
Sent: Mon, 13 September, 2010 12:53:11
Subject: Re: Database name length
Tiago Espinha <[email protected]> writes:
> Thank you Knut, for your reply.
>
> Your point #1 is correct. As for point #2 and #3 just a small correction. It
> is
>
> all characters falling outside the *US-ASCII* encoding that will get a length
> lower than 255 characters as anything other than ASCII requires more than
> just
>1
>
> byte to encode. I'm fairly sure that at this point we do not support
> ISO-8859-1
>
> through the client driver as these characters (the extended ones like áéó
> etc)
> fall outside US-ASCII. So hopefully this won't break anything as we didn't
> support these characters previously.
I think we do support this. At least, this code ran fine on my machine
with Derby 10.6.1.0 and created a database named áéó:
Connection c = DriverManager.getConnection(
"jdbc:derby://localhost/\u00E1\u00E9\u00F3;create=true");
> As for your suggestion of increasing the length of the field, I'm not sure
> that's an option. This length limitation is imposed by the DRDA specification
> and the ACR unfortunately didn't change this. On the ACR it reads "As of DDM
> Level 7, the RDBNAM can accommodate an RDB name of up to 255 bytes in length,
> and its format will vary depending on the length of the RDB name". So
> essentially, we could easily support a much larger RDB name on Derby but the
> specification forbids it.
DRDA does allow product-unique extensions. I have a hard time seeing any
downside with extending the protocol here. Sending a longer string than
what a strict reading of the spec permits sounds like a lesser evil to
me than disallowing network access to the database.
--
Knut Anders