Subject Re: JDBC Type 4 Driver - Exception
Author rrokytskyy
> I've tried setting the 'lc_ctype' property to 'ISO_8859_1' and it
> has no effect. I still get the same exception in the same place.

Sorry, that should be ISO8859_1.

> The code Im using to obtain the connection is as follows :
>
> final Properties info = new Properties();
> info.setProperty( "user", ...);
> info.setProperty( "password", ...);
> info.setProperty( "lc_ctype", "ISO_8859_1" );
>
> return DriverManager.getConnection
> ("jdbc:firebirdsql:localhost/3050:C:\\AName.gdb", info));
>
> Now I have a query which does a SELECT DISTINCT( 5 ) FROM FOO and
> this one runs ok. But when a query selects all the fields, the
> exception is thrown. Note: not all the VARCHAR fields that are
> being have 'CHARACTER SET ISO8859_1 COLLATE EN_UK' applied. I dont
> know if this a problem ?

Might be. There are one issue when you have charset specified:
Firebird should know how to convert characters from the charset
specified for connection to charset specified for column and vice
versa. Some rules are (just from my experiance and docs):

- Firebird knows how to convert from UNICODE_FSS to any;
- Firebird _does not_ know how to convert NONE to any;
- Firebird might know how to convert from A to B and might not.

This means:

- If you do not specify the charset for database and for columns, it
is automatically NONE and your connection charset should be NONE too.

- If your connection has charset NONE, you can select from any
column, but you cannot write to columns, that have charset other than
NONE.

- If your connection has charset other than NONE, you can read/write
only those columns, where Firebird is able to convert characters.


So, I would suggest following:

- set some default charset for database;
- use "lc_ctype=UNICODE_FSS".

or

- drop all charset definitions;
- use "lc_ctype=NONE".

This should work.

Best regards,
Roman Rokytskyy