Subject Re: Automatic encoding value (jdbc:xxxx?encoding=auto)?
Author mailmur

>>Is it technically possible to make it all automatic, Java jdbc
drivers after all should give just unicodes due to java IS unicode
already. Or to have a special url parameter "encoding=auto" and client
would decide what to use based on a database default charset.

>Firebird will convert data from the database or column encoding
>into the specified encoding transparently.

Well, I have always found a documentation about the
charset+encoding+collation+functions Firebird issues rather difficult.
One thing users find often is "it just works" slogan is not applied
here. Some other dbs do provide "it just works" transparency.

In the year 2006 and developing applications with modern languages
(java, C#) we should no more have i18n character problems. Creating
dbs with legacy ISO-x encodings however breaks this dream world.

>The main issue here is the performance. When the encoding specified
>for the connection differs from the charset in which content
>is defined, there's some job to do for Firebird and there's
>job to do for JVM

>So, if your databases have some encoding specified, just use
>encoding=UTF8 which is as convenient as encoding=auto and
>it will do the job, unless you care about the performance.

Ok, if I keep creating all my databases with UTF8 default charset and
url param has "encoding=UTF8" value then Firebird2 server does not
need to do extra work converting string values. It is up to client
machines do what it takes converting utf8 to java internal UCS unicode.

Best would(?) be using exact match to Java's internal UCS format to
minimize byte conversions, but I live with UTF8 for now.

So, here is my best practise for dummies example for jaybird-FB2
environments :-)
1) always give "UTF8" default charset when creating a database
Run "{fb}\bin\isql.exe" commandline util to create a database
SQL> CREATE DATABASE 'c:\firebird2\db\testutf8.fdb'
user 'sysdba' password 'masterkey' DEFAULT CHARACTER UTF8;
SQL> SELECT * FROM rdb$database;

2) do not change it per columns within tables

3) always give "encoding=UTF8" jdbc url parameter
jdbc url example:

jdbc driver's classname for standalone applications:

4) collation, sorting
that's the area what I still don't handle well. I don't know if there
is one-for-all collation possible. Now I don't care it and let db
server choose what it please, but I must study this issue some day.

ps: found this link, it provides nice tables about charsets.