Subject Re: [Firebird-Java] Connection character set information
Author Mark Rotteveel
On 20-2-2017 23:20, 'William L. Thomson Jr.' wlt-ml@...
[Firebird-Java] wrote:
> Just so it is not buried in the other thread, easy for others to find. It seems
> for anyone coming from Jaybird 2.x to Jaybird 3.x. The settings that must be
> in place for Jaybird 3.x, also work for 2.x. Which makes it a good migration
> path setting. Add now to Jaybird 2.x, and your good for Jaybird 3.x
>
> For direct JDBC connection, not in a container, etc add both
> lc_type and chartSet.
>
> jdbc:firebirdsql:my.domain.com/3050:/path/to/data.fdb?
> lc_type=NONE&charSet=ISO-8895-1

Using both lc_ctype=NONE (not lc_type(!)) and charSet=ISO-8859-1 is only
necessary if you really want to use connection character set NONE and
interpret NONE as ISO-8859-1 and columns with explicit character sets in
their respective character sets, otherwise using just charSet=ISO-8895-1
will be equivalent to using lc_ctype=ISO8859_1.

> Then when in a container, charSet becomes a value in the connection
> properties, not in jdbc url like previous.
>
> Commons DBCP example
>
> <Resource auth="Container"
> driverClassName="org.firebirdsql.jdbc.FBDriver"
> factory="org.apache.commons.dbcp2.BasicDataSourceFactory"
> logAbandoned="true"
> maxTotal="5"
> maxIdle="5"
> name="jdbc/my_res"
> charSet="ISO-8859-1"
> username="username"
> password="password"
> url="jdbc:firebirdsql:my.domain.com/3050:/path/to/data.fdb?
> lc_ctype=NONE" />
>
> At least with Commons DBCP this does produce an error but still works.
>
> org.apache.commons.dbcp2.BasicDataSourceFactory.getObjectInstance Name =
> my_res Ignoring unknown property: value of "ISO-8859-1" for "charSet" property

If you are configuring DBCP this way, then you are not setting the
Jaybird charSet property, and you are only specifying lc_ctype=NONE. You
either need to set the property in the URL, or use connectionProperties
with semi-colon separated entries. See
https://commons.apache.org/proper/commons-dbcp/configuration.html


--
Mark Rotteveel