I'm working with Firebird database in Java. Everything works fine, but I have problem with connecting to my database if database file path contains national characters, eg. "á" or "č".
Sample exception:
org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544344. I/O error during "CreateFile (open)" operation for file "Z:/testing/á/sample.fdb"
Path is correct, database exists. Jaybird / JDBC has problem with "á" character in path.
Any ideas how to fix it or where is problem? Thanks for all responses.
OS: Windows 7 Pro 64 bit
JDK: 1.7.0.25
Jaybird: 2.2.3
Starting with Jaybird 3, database filename will always be sent as UTF-8, if the server is Firebird 2.5 or higher.
Jaybird 2.2 and earlier has limited support for special characters in the databasename. There are several options you can use to workaround this problem, but if they actually work depends highly on the version of Firebird and the default characterset of the OS (where Firebird is running).
Option 1: use connection property
filename_charset=<name of charset>where<name of charset>is the default character set of the operating system where the Firebird server is running.For example:
Option 2 (Firebird 2.5 or higher, with Jaybird 2.2): use the workaround described in JDBC-251:
Start your Java application with
-Dfile.encoding=UTF8and includeutf8_filename=1in the connection URL:When using this option, make sure that you already specify a connection characterset using connection property
charSet,localEncodingorlocal_encoding(for Java character set names), and/orencodingorlc_ctype(for Firebird character set names). If not, you are using Firebird character setNONEwhich uses the JVM default character set, and you will need to set thecharSetto the 'normal' default encoding of your JVM to prevent character set conversion issues because of the changed value offile.encoding(in some cases - in addition to specifyingcharSet- you may also explicitly need to setencodingtoNONE).Option 3: Define an alias with only ASCII characters in
aliases.confof the firebird server for the database and connect using this alias instead:Disclosure: I am one of the Jaybird developers