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
FBBackupManager cannot restore backup with accented character in backup path [JDBC427] #468
Comments
Modified by: A Drouard (adrouard)environment: Windows 8.1 => Windows 8.1 |
Commented by: @mrotteveel What is the value of System.getProperty("file.encoding") when this application is run? Unfortunately, the implementation in Jaybird 2.2.x can only use the default characterset in service operations (this should be improved with 3.0), so if this file.encoding value is for example utf-8, then Firebird will not interpret it correctly because (on Windows) it usually uses one of the windows-xxxx (one byte) character sets. The workaround is to either not use accented characters, or to specify your local system character set using -Dfile.encoding=... (eg -Dfile.encoding=Cp1252 in Western Europe) on the Java commandline. |
Modified by: @mrotteveelFix Version: Jaybird 3.0 [ 10440 ] |
Commented by: A Drouard (adrouard) System.getProperty("file.encoding") is UTF-8 |
Commented by: @mrotteveel That is a link to the old wiki that is no longer maintained (unfortunately there is only a redirect from the top-level of the old wiki to the new). The new wiki is on https://github.com/FirebirdSQL/jaybird/wiki/ The 'roadmap' is on https://github.com/FirebirdSQL/jaybird/wiki/Roadmap but I haven't updated it for a while (and its content is almost the same as on the old wiki). Unfortunately planning a release is a bit hard to do; I do this in my spare time so plans can slip and be delayed. You can also look at the release notes of the current snapshot http://www.firebirdsql.org/file/documentation/drivers_documentation/java/3.0.0-SNAPSHOT/release_notes.html The snapshot is available from the Sonatype OSS snapshot repository (see release notes) or from https://sourceforge.net/projects/firebird/files/firebird-jca-jdbc-driver/3.0.0-SNAPSHOT/ I haven't addressed all character set related problems yet in 3.0, and I believe this is one of them. |
Commented by: @mrotteveel It turns out I was a little bit too optimistic about this. As it turns out Firebird doesn't have a mechanism to specify the character set of the strings in the service request buffer. Since 2.5 it has an option for the service parameter buffer, but that can't be used for SRBs and setting it in the SPB doesn't affect the SRB. Instead I have added a `setCharSet` method on the service managers, so control about the character set can be done from code, so it is not necessary to use a system-wide change of file.encoding. I hope this can be improved in the future, but it looks like Firebird simply doesn't provide enough support here. |
Commented by: @mrotteveel It looks like Firebird 3 and Jaybird 3 will work correctly after a change I just made, but then the specified charSet needs to be UTF-8. I will see if I can enforce use of UTF-8 when connected to Firebird 3. |
Commented by: @mrotteveel Made modifications to enforce use of UTF-8 with Firebird 3. |
Modified by: @mrotteveelstatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: A Drouard (adrouard)
Votes: 1
The following code, cause a GDSException with message "cannot open backup file c:/base/backup_é.fbk".
The same code with a backup path without accented character is successful.
FBBackupManager backupManager = new FBBackupManager("PURE_JAVA");
backupManager.setBackupPath("c:/base/backup_é.fbk");
backupManager.setDatabase("c:/base/database.fdb");
backupManager.setUser("sysdba");
backupManager.setPassword("masterkey");
backupManager.setHost("localhost");
backupManager.setVerbose(true);
backupManager.setPort(3050);
backupManager.restoreDatabase(ISCConstants.isc_spb_res_create | ISCConstants.isc_spb_res_replace);
Caused by: org.firebirdsql.jdbc.FBSQLException: GDS Exception. 336330817. cannot open backup file c:/base/backup_é.fbk
at org.firebirdsql.management.FBServiceManager.executeServicesOperation(FBServiceManager.java:280)
at org.firebirdsql.management.FBBackupManager.restoreDatabase(FBBackupManager.java:261)
Caused by: org.firebirdsql.gds.GDSException: cannot open backup file c:/base/backup_é.fbk
at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.readStatusVector(AbstractJavaGDSImpl.java:2682)
at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.receiveResponse(AbstractJavaGDSImpl.java:2648)
at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.iscServiceQuery(AbstractJavaGDSImpl.java:2834)
at org.firebirdsql.management.FBServiceManager.queueService(FBServiceManager.java:227)
at org.firebirdsql.management.FBServiceManager.executeServicesOperation(FBServiceManager.java:275)
The text was updated successfully, but these errors were encountered: