Subject | Re: Why createBackup and restoreDatabase take different format for Filenames ? |
---|---|
Author | Ashok122 |
Post date | 2006-10-25T15:05:16Z |
Never mind.
It works now.
I was supposed to use slash in restoreBackup call instead of backslash.
Thanks,
Ashok
It works now.
I was supposed to use slash in restoreBackup call instead of backslash.
Thanks,
Ashok
>FBBackupManager(GDSType.getType("PURE_JAVA"));
> import java.io.*;
> import java.sql.SQLException;
> import org.firebirdsql.gds.impl.GDSType;
> import org.firebirdsql.management.FBBackupManager; // Needed to create
> new BACKUP.
>
> public class TestCase1 {
>
> public static void main(String args[]) {
> CreateBackup("c:/backups/big.FDB",
> "c:/backups/testNew16.fbk", "STARGAZER"); // Tested OK
> /*
>
> RestoreBackup("c:/backups/new2.fdb",
> "c:/backups/testNew16.fbk",
> "STARGAZER");
> */
>
> // Following works, but I get GDS Exception. 406. No message for
> code 406 found.
> // How do I get rid of this error?
> RestoreBackup("STARGAZER:c:/backups/testNew21.fdb",
> "\\\\STARGAZER\\backups\\testNew16.fbk", "STARGAZER");
> }
>
> public static void CreateBackup(String sFDBName,
> String sFBKName, String sSrvrName) {
> String sSrcDBPath_and_fileName = sFDBName;
> String sTgtDBPath_and_fileName = sFBKName;
> FBBackupManager fb = new
> fb.setPort(3050);FBBackupManager(GDSType.getType("PURE_JAVA"));
> fb.setHost(sSrvrName);
> fb.setLogger(System.out);
> fb.setVerbose(true);
> fb.setUser("sysdba");
> fb.setPassword("masterkey");
> fb.setDatabase(sSrcDBPath_and_fileName);
> fb.setBackupPath(sTgtDBPath_and_fileName);
> try {
> fb.backupDatabase();
> } catch (SQLException ex) {
> ex.printStackTrace();
> }
> }
>
> public static void RestoreBackup(String sFDBName,
> String sFBKName, String sSrvrName) {
> String sSrcDBPath_and_fileName = sFDBName;
> String sTgtDBPath_and_fileName = sFBKName;
> FBBackupManager fb = new
> fb.setUser("sysdba");
> fb.setPort(3050);
> fb.setHost(sSrvrName);
> fb.setPassword("masterkey");
> fb.setLogger(System.out);
> fb.setVerbose(true);
> fb.setDatabase(sSrcDBPath_and_fileName);
> fb.setBackupPath(sTgtDBPath_and_fileName);
> fb.setRestoreReplace(false);
> try {
> fb.restoreDatabase();
> } catch (SQLException ex) {
> ex.printStackTrace();
> }
> }
>
> }
>