Subject Re: [Firebird-Java] Connection character set information
Author Mark Rotteveel
On 2017-03-09 19:23, 'William L. Thomson Jr.' wlt-ml@...
[Firebird-Java] wrote:
> Seeing a bit of inconsistency. For some this works, for others not. I
> cannot explain why it works for some and not others. Database are the
> same charset.
>
> jdbc:firebirdsql:my.domain.com/3050:/path/to/data.fdb?lc_type=NONE
>
> This seems to be more reliable. I have not had any problems
> connecting.
>
> jdbc:firebirdsql:my.domain.com/3050:/path/to/data.fdb?charSet=ISO-8895-1
>
>
> Both do not seem to be required, but do not seem to hurt if both are
> set. Just seems charSet is more reliable than lc_type. I think the
> lc_type allows Jaybird 3 to work with Firebird < 3. When you have
> Jaybird 3.x and Firebird 3.x, you need to use charSet not lc_type.

Jaybird doesn't have a connection property lc_type, so observations that
lc_type=NONE don't work can be explained by that. You need to use
lc_ctype (or its alias encoding). Non-existent connection properties are
ignored. In Jaybird 2.2 and earlier lc_type=NONE might seem to work,
because that was the default for lc_ctype anyway.

Also be aware that using charSet=ISO-8859-1 is equivalent to using
lc_ctype=ISO8859-1 (or lc_ctype=ISO8859-1&charSet=ISO-8859-1); it is not
the same as using lc_ctype=NONE (nor using
lc_ctype=NONE&charSet=ISO-8859-1), unless all the columns in your
database are NONE or ISO-8859-1.

In Jaybird 2.2:
* lc_ctype=NONE means use connection encoding NONE and interpret
everything using the default JVM encoding (eg Cp1252 on Windows in
Western Europe (+ US?), UTF-8 on most Linux environments)
* lc_ctype=NONE&charSet=ISO-8859-1 the same, but instead of the JVM
default, use ISO-8859-1

In Jaybird 3.0:
* lc_ctype=NONE means connection encoding NONE and interpret columns
with character set NONE using the default JVM encoding, and interpret
columns with an explicit character set in their equivalent Java
character set
* lc_ctype=NONE&charSet=ISO-8859-1 the same, but instead of the JVM
default, use ISO-8859-1

In both versions:
* lc_ctype=<firebird charset>* use connection encoding <firebird
charset> and interpret in the equivalent Java character set
* charSet=<java charset> use Firebird equivalent of <java charset> as
connection encoding and interpret in <java charset>
* lc_ctype=<firebird charset>*&charSet=<java charset> use connection
encoding <firebird charset>, but interpret in <java charset>

*: other than NONE

Mark