I've created a database using jaybirds' class FBManager
, but I can't find a way to specify a default charset
for it (defaults as NONE
).
Am I missing something? Is it possible to define it after the database was created?
This is the snippet used to create it
FBManager fbm = new FBManager();
fbm.start();
fbm.createDatabase("./fb.fdb", "user", "password");
fbm.stop();
This feature is now available in Jaybird version 3.0.6 and higher. See the accepted answer for more details.
You aren't missing anything: this feature is indeed absent from FBManager
. Consider filing an improvement ticket on http://tracker.firebirdsql.org/browse/JDBC
This feature is now available in Jaybird 3.0.6 and higher. The method FBManager.setDefaultCharacterSet
was added to set the default character set.
For earlier versions of Jaybird, as a workaround, you will need to alter the default character set after creating the database.
For Firebird 3 and higher you can do this by using
ALTER DATABASE SET DEFAULT CHARACTER SET UTF8
See also Alter the Default Character Set in the Firebird 3 release notes.
For Firebird 2.5 and earlier you'll need to modify the system tables directly (this is no longer supported in Firebird 3):
UPDATE RDB$DATABASE SET RDB$CHARACTER_SET_NAME = 'UTF8'
Replace UTF8
with your intended default character set if it is a different character set.
Either statement must be executed as the database owner or as user SYSDBA.
Be aware, changing the default character set only has effect on columns created after the new default has been set. Existing (var)char columns will retain their old character set.
Disclaimer: I maintain the Jaybird JDBC driver for Firebird.