Issue Details (XML | Word | Printable)

Key: JDBC-427
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Mark Rotteveel
Reporter: A Drouard
Votes: 1
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Jaybird JCA/JDBC Driver

FBBackupManager cannot restore backup with accented character in backup path

Created: 05/Apr/16 12:10 PM   Updated: 07/May/17 12:32 PM
Component/s: None
Affects Version/s: Jaybird 2.2.9, Jaybird 2.2.10
Fix Version/s: Jaybird 3.0.0

Environment:
Windows 8.1
Java 8
Jaybird 2.2.10
Firebird 2.5


 Description  « Hide
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)

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Mark Rotteveel added a comment - 06/Apr/16 07:42 AM - edited
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.

A Drouard added a comment - 06/Apr/16 08:04 AM - edited
System.getProperty("file.encoding") is UTF-8
The workaround (with -Dfile.encoding=Cp1252) works for me, thanks.
Where can I find Jaybird 3.0 roadmap or release plan ?
Maybe here ? http://jaybirdwiki.firebirdsql.org/jaybird/doku.php?id=info:roadmap
but Last modified is 2013/11/02...

Mark Rotteveel added a comment - 06/Apr/16 08:43 AM
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.

Mark Rotteveel added a comment - 10/Apr/16 08:21 AM
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.

Mark Rotteveel added a comment - 10/Apr/16 08:40 AM
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.

Mark Rotteveel added a comment - 23/Apr/16 12:58 PM
Made modifications to enforce use of UTF-8 with Firebird 3.