New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to define default charset when creating a database with org.firebirdsql.management.FBManager [JDBC541] #574
Comments
Modified by: Diego Scarmal (pebabr)description: It is not possible to choose a default charset (defaults to NONE) when creating a database with the FBManager. I propose a setter on it to define the default charset, something like the following Quoting the workaroung provided by Mark Rotteveel @ [stack overflow|https://stackoverflow\.com/questions/51715228/set\-default\-charset\-on\-a\-database\-created\-with\-fbmanager/51726114#⁠51726114\] {quote} 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. => It is not possible to choose a default charset (defaults to NONE) when creating a database with the FBManager. I propose a setter on it to define the default charset, something like the following FBManager fbm = new FBManager(); Quoting the workaroung provided by Mark Rotteveel stack overflow (https://stackoverflow.com/questions/51715228/set-default-charset-on-a-database-created-with-fbmanager/51726114#51726114. 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. |
Commented by: @mrotteveel Tentatively scheduled for Jaybird 4, may slip to a later version. I'm not 100% sure if the Firebird API used for creating the database exposes an option to set the default character set; this may need explicit execution of a statement after creation of the database. |
Modified by: @mrotteveelFix Version: Jaybird 4 [ 10441 ] |
Commented by: @mrotteveel |
Commented by: @mrotteveel Backported to Jaybird 3.0.6 |
Modified by: @mrotteveelFix Version: Jaybird 3.0.6 [ 10883 ] |
Modified by: @mrotteveelstatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: Diego Scarmal (pebabr)
It is not possible to choose a default charset (defaults to NONE) when creating a database with the FBManager.
I propose a setter on it to define the default charset, something like the following
FBManager fbm = new FBManager();
fbm.setDefaultCharset("UTF8");
...
Quoting the workaroung provided by Mark Rotteveel stack overflow (https://stackoverflow.com/questions/51715228/set-default-charset-on-a-database-created-with-fbmanager/51726114#51726114.
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.
Commits: 449ba79 5a8b1e7
The text was updated successfully, but these errors were encountered: