Loading ...
Sorry, an error occurred while loading the content.

Embedded DB backup

Expand Messages
  • pcmilhouse
    Dear All, I m developing a software base on FirebirdDB (user can choose if server or embedded). I m trying to backup DB. With server DB no problem, but with
    Message 1 of 10 , Jan 15, 2010
    • 0 Attachment
      Dear All,
      I'm developing a software base on FirebirdDB (user can choose if server or embedded).
      I'm trying to backup DB. With server DB no problem, but with embedded I can't export nothing.
      Can anyone help me? Have I to set host and port also in embedded?
      Is FBBackupManager("EMBEDDED") constructor right?

      Below the code:

      FBBackupManager fbbm = new FBBackupManager("EMBEDDED");
      fbbm.setBackupPath(backupFile.getAbsolutePath());
      fbbm.setDatabase(new File(dbFile).getAbsolutePath());
      fbbm.setUser(Services.settings.DBusernameAdmin);
      fbbm.setPassword(Services.settings.DBpasswordAdmin);
      fbbm.setVerbose(true);
      fbbm.setLogger(System.out);

      fbbm.backupDatabase();

      Thanks in advance
    • Roman Rokytskyy
      ... AFAIR, no. ... Right. ... That s how I would do myself :) Will check on my computer. Roman
      Message 2 of 10 , Jan 15, 2010
      • 0 Attachment
        > I'm developing a software base on FirebirdDB (user can choose if server or embedded).
        > I'm trying to backup DB. With server DB no problem, but with embedded I can't export nothing.
        > Can anyone help me? Have I to set host and port also in embedded?

        AFAIR, no.

        > Is FBBackupManager("EMBEDDED") constructor right?

        Right.

        > Below the code:
        >
        > FBBackupManager fbbm = new FBBackupManager("EMBEDDED");
        > fbbm.setBackupPath(backupFile.getAbsolutePath());
        > fbbm.setDatabase(new File(dbFile).getAbsolutePath());
        > fbbm.setUser(Services.settings.DBusernameAdmin);
        > fbbm.setPassword(Services.settings.DBpasswordAdmin);
        > fbbm.setVerbose(true);
        > fbbm.setLogger(System.out);
        >
        > fbbm.backupDatabase();

        That's how I would do myself :) Will check on my computer.

        Roman
      • pcmilhouse
        Thanks Roman... The path I use for db is a String like C:/Database/db.FDB and for backup a similar string. Let me know if there could be errors in params...
        Message 3 of 10 , Jan 15, 2010
        • 0 Attachment
          Thanks Roman...
          The path I use for db is a String like "C:/Database/db.FDB" and for backup a similar string.
          Let me know if there could be errors in params...

          --- In Firebird-Java@yahoogroups.com, Roman Rokytskyy <roman@...> wrote:
          >
          > > I'm developing a software base on FirebirdDB (user can choose if server or embedded).
          > > I'm trying to backup DB. With server DB no problem, but with embedded I can't export nothing.
          > > Can anyone help me? Have I to set host and port also in embedded?
          >
          > AFAIR, no.
          >
          > > Is FBBackupManager("EMBEDDED") constructor right?
          >
          > Right.
          >
          > > Below the code:
          > >
          > > FBBackupManager fbbm = new FBBackupManager("EMBEDDED");
          > > fbbm.setBackupPath(backupFile.getAbsolutePath());
          > > fbbm.setDatabase(new File(dbFile).getAbsolutePath());
          > > fbbm.setUser(Services.settings.DBusernameAdmin);
          > > fbbm.setPassword(Services.settings.DBpasswordAdmin);
          > > fbbm.setVerbose(true);
          > > fbbm.setLogger(System.out);
          > >
          > > fbbm.backupDatabase();
          >
          > That's how I would do myself :) Will check on my computer.
          >
          > Roman
          >
        • Roman Rokytskyy
          ... Tried unit test cases with FB 2.5 embedded, works fine. The example code is the following: backupManager = new FBBackupManager(getGdsType());
          Message 4 of 10 , Jan 15, 2010
          • 0 Attachment
            > That's how I would do myself :) Will check on my computer.

            Tried unit test cases with FB 2.5 embedded, works fine. The example code
            is the following:

            backupManager = new FBBackupManager(getGdsType());
            backupManager.setUser(DB_USER);
            backupManager.setPassword(DB_PASSWORD);
            backupManager.setDatabase(getDatabasePath());
            backupManager.setBackupPath(getBackupPath());
            backupManager.setLogger(System.out);
            backupManager.setVerbose(true);

            backupManager.backupDatabase();
            backupManager.restoreDatabase();

            What exceptions do you get?

            Roman
          • pcmilhouse
            This is the exception I had on backup: GRAVE: null org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544344. I/O error for file CreateFile (open) Error
            Message 5 of 10 , Jan 17, 2010
            • 0 Attachment
              This is the exception I had on backup:

              GRAVE: null
              org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544344. I/O error for file CreateFile (open) ""
              Error while trying to open file
              null
              at org.firebirdsql.management.FBServiceManager.executeServicesOperation(FBServiceManager.java:280)
              at org.firebirdsql.management.FBBackupManager.backupDatabase(FBBackupManager.java:215)
              at org.firebirdsql.management.FBBackupManager.backupDatabase(FBBackupManager.java:201)
              at com.tecnosens.ladon.dbInterface.DbManagement.exportDB(DbManagement.java:312)
              at com.tecnosens.ladon.core.TestLadon.doTest(TestLadon.java:105)
              at com.tecnosens.ladon.core.TestLadon.main(TestLadon.java:88)
              at org.firebirdsql.gds.GDSException: I/O error for file CreateFile (open) ""
              Error while trying to open file
              null
              at org.firebirdsql.gds.impl.jni.JniGDSImpl.native_isc_service_query(Native Method)
              at org.firebirdsql.gds.impl.jni.BaseGDSImpl.iscServiceQuery(BaseGDSImpl.java:829)
              at org.firebirdsql.management.FBServiceManager.queueService(FBServiceManager.java:227)
              null
              at org.firebirdsql.management.FBServiceManager.executeServicesOperation(FBServiceManager.java:275)
              at org.firebirdsql.management.FBBackupManager.backupDatabase(FBBackupManager.java:215)
              at org.firebirdsql.management.FBBackupManager.backupDatabase(FBBackupManager.java:201)
              at com.tecnosens.ladon.dbInterface.DbManagement.exportDB(DbManagement.java:312)
              at com.tecnosens.ladon.core.TestLadon.doTest(TestLadon.java:105)
              at com.tecnosens.ladon.core.TestLadon.main(TestLadon.java:88)

              --- In Firebird-Java@yahoogroups.com, Roman Rokytskyy <roman@...> wrote:
              >
              >
              > > That's how I would do myself :) Will check on my computer.
              >
              > Tried unit test cases with FB 2.5 embedded, works fine. The example code
              > is the following:
              >
              > backupManager = new FBBackupManager(getGdsType());
              > backupManager.setUser(DB_USER);
              > backupManager.setPassword(DB_PASSWORD);
              > backupManager.setDatabase(getDatabasePath());
              > backupManager.setBackupPath(getBackupPath());
              > backupManager.setLogger(System.out);
              > backupManager.setVerbose(true);
              >
              > backupManager.backupDatabase();
              > backupManager.restoreDatabase();
              >
              > What exceptions do you get?
              >
              > Roman
              >
            • Roman Rokytskyy
              It means that it cannot open the file... Can you provide the values of backupFile.getAbsolutePath() and new File(dbFile).getAbsolutePath()?
              Message 6 of 10 , Jan 18, 2010
              • 0 Attachment
                It means that it cannot open the file... Can you provide the values of
                backupFile.getAbsolutePath() and new File(dbFile).getAbsolutePath()?

                18.01.2010 08:59, pcmilhouse написав(ла):
                > This is the exception I had on backup:
                >
                > GRAVE: null
                > org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544344. I/O error for file CreateFile (open) ""
                > Error while trying to open file
                > null
                > at org.firebirdsql.management.FBServiceManager.executeServicesOperation(FBServiceManager.java:280)
                > at org.firebirdsql.management.FBBackupManager.backupDatabase(FBBackupManager.java:215)
                > at org.firebirdsql.management.FBBackupManager.backupDatabase(FBBackupManager.java:201)
                > at com.tecnosens.ladon.dbInterface.DbManagement.exportDB(DbManagement.java:312)
                > at com.tecnosens.ladon.core.TestLadon.doTest(TestLadon.java:105)
                > at com.tecnosens.ladon.core.TestLadon.main(TestLadon.java:88)
                > at org.firebirdsql.gds.GDSException: I/O error for file CreateFile (open) ""
                > Error while trying to open file
                > null
                > at org.firebirdsql.gds.impl.jni.JniGDSImpl.native_isc_service_query(Native Method)
                > at org.firebirdsql.gds.impl.jni.BaseGDSImpl.iscServiceQuery(BaseGDSImpl.java:829)
                > at org.firebirdsql.management.FBServiceManager.queueService(FBServiceManager.java:227)
                > null
                > at org.firebirdsql.management.FBServiceManager.executeServicesOperation(FBServiceManager.java:275)
                > at org.firebirdsql.management.FBBackupManager.backupDatabase(FBBackupManager.java:215)
                > at org.firebirdsql.management.FBBackupManager.backupDatabase(FBBackupManager.java:201)
                > at com.tecnosens.ladon.dbInterface.DbManagement.exportDB(DbManagement.java:312)
                > at com.tecnosens.ladon.core.TestLadon.doTest(TestLadon.java:105)
                > at com.tecnosens.ladon.core.TestLadon.main(TestLadon.java:88)
                >
                > --- In Firebird-Java@yahoogroups.com, Roman Rokytskyy<roman@...> wrote:
                >>
                >>
                >>> That's how I would do myself :) Will check on my computer.
                >>
                >> Tried unit test cases with FB 2.5 embedded, works fine. The example code
                >> is the following:
                >>
                >> backupManager = new FBBackupManager(getGdsType());
                >> backupManager.setUser(DB_USER);
                >> backupManager.setPassword(DB_PASSWORD);
                >> backupManager.setDatabase(getDatabasePath());
                >> backupManager.setBackupPath(getBackupPath());
                >> backupManager.setLogger(System.out);
                >> backupManager.setVerbose(true);
                >>
                >> backupManager.backupDatabase();
                >> backupManager.restoreDatabase();
                >>
                >> What exceptions do you get?
                >>
                >> Roman
                >>
                >
                >
                >
                >
                > ------------------------------------
                >
                > Yahoo! Groups Links
                >
                >
                >
                >
              • pcmilhouse
                The value of both path are correct and the db file exists. I can t understand where could be the problem...maybe the db file is locked. But backup works also
                Message 7 of 10 , Jan 18, 2010
                • 0 Attachment
                  The value of both path are correct and the db file exists.
                  I can't understand where could be the problem...maybe the db file is locked. But backup works also if I have any connection opened to db.

                  --- In Firebird-Java@yahoogroups.com, Roman Rokytskyy <roman@...> wrote:
                  >
                  > It means that it cannot open the file... Can you provide the values of
                  > backupFile.getAbsolutePath() and new File(dbFile).getAbsolutePath()?
                  >
                  > 18.01.2010 08:59, pcmilhouse написав(ла):
                  > > This is the exception I had on backup:
                  > >
                  > > GRAVE: null
                  > > org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544344. I/O error for file CreateFile (open) ""
                  > > Error while trying to open file
                  > > null
                  > > at org.firebirdsql.management.FBServiceManager.executeServicesOperation(FBServiceManager.java:280)
                  > > at org.firebirdsql.management.FBBackupManager.backupDatabase(FBBackupManager.java:215)
                  > > at org.firebirdsql.management.FBBackupManager.backupDatabase(FBBackupManager.java:201)
                  > > at com.tecnosens.ladon.dbInterface.DbManagement.exportDB(DbManagement.java:312)
                  > > at com.tecnosens.ladon.core.TestLadon.doTest(TestLadon.java:105)
                  > > at com.tecnosens.ladon.core.TestLadon.main(TestLadon.java:88)
                  > > at org.firebirdsql.gds.GDSException: I/O error for file CreateFile (open) ""
                  > > Error while trying to open file
                  > > null
                  > > at org.firebirdsql.gds.impl.jni.JniGDSImpl.native_isc_service_query(Native Method)
                  > > at org.firebirdsql.gds.impl.jni.BaseGDSImpl.iscServiceQuery(BaseGDSImpl.java:829)
                  > > at org.firebirdsql.management.FBServiceManager.queueService(FBServiceManager.java:227)
                  > > null
                  > > at org.firebirdsql.management.FBServiceManager.executeServicesOperation(FBServiceManager.java:275)
                  > > at org.firebirdsql.management.FBBackupManager.backupDatabase(FBBackupManager.java:215)
                  > > at org.firebirdsql.management.FBBackupManager.backupDatabase(FBBackupManager.java:201)
                  > > at com.tecnosens.ladon.dbInterface.DbManagement.exportDB(DbManagement.java:312)
                  > > at com.tecnosens.ladon.core.TestLadon.doTest(TestLadon.java:105)
                  > > at com.tecnosens.ladon.core.TestLadon.main(TestLadon.java:88)
                  > >
                  > > --- In Firebird-Java@yahoogroups.com, Roman Rokytskyy<roman@> wrote:
                  > >>
                  > >>
                  > >>> That's how I would do myself :) Will check on my computer.
                  > >>
                  > >> Tried unit test cases with FB 2.5 embedded, works fine. The example code
                  > >> is the following:
                  > >>
                  > >> backupManager = new FBBackupManager(getGdsType());
                  > >> backupManager.setUser(DB_USER);
                  > >> backupManager.setPassword(DB_PASSWORD);
                  > >> backupManager.setDatabase(getDatabasePath());
                  > >> backupManager.setBackupPath(getBackupPath());
                  > >> backupManager.setLogger(System.out);
                  > >> backupManager.setVerbose(true);
                  > >>
                  > >> backupManager.backupDatabase();
                  > >> backupManager.restoreDatabase();
                  > >>
                  > >> What exceptions do you get?
                  > >>
                  > >> Roman
                  > >>
                  > >
                  > >
                  > >
                  > >
                  > > ------------------------------------
                  > >
                  > > Yahoo! Groups Links
                  > >
                  > >
                  > >
                  > >
                  >
                • Roman Rokytskyy
                  ... What about file permissions? Or network path? ... Can it be that the backup file is open by the superserver binary at the same time? This one opens file
                  Message 8 of 10 , Jan 18, 2010
                  • 0 Attachment
                    > The value of both path are correct and the db file exists.

                    What about file permissions? Or network path?

                    > I can't understand where could be the problem...maybe the db file is locked. But backup works also if I have any connection opened to db.

                    Can it be that the backup file is open by the superserver binary at the
                    same time? This one opens file exclusively, so you cannot connect to it
                    with embedded...

                    Roman
                  • pcmilhouse
                    Now it works. There was another process connected to embedded DB. But if I try to restore db from backup file, then DB is not more accessible. ... name
                    Message 9 of 10 , Jan 18, 2010
                    • 0 Attachment
                      Now it works. There was another process connected to embedded DB.
                      But if I try to restore db from backup file, then DB is not more accessible.
                      I also tried to restore db with gbak utilities but I have this output:

                      >>Done with volume #1, >>"C:\NetBeansProjects\Ladon7\ladon7code\update\restoreLadonD
                      >>B.fbk" Press return to reopen that file, or type a new
                      name followed by return to open a different file. Name:

                      Surely I forget some parameters... it seems that restore process needs something else...


                      --- In Firebird-Java@yahoogroups.com, Roman Rokytskyy <roman@...> wrote:
                      >
                      > > The value of both path are correct and the db file exists.
                      >
                      > What about file permissions? Or network path?
                      >
                      > > I can't understand where could be the problem...maybe the db file is locked. But backup works also if I have any connection opened to db.
                      >
                      > Can it be that the backup file is open by the superserver binary at the
                      > same time? This one opens file exclusively, so you cannot connect to it
                      > with embedded...
                      >
                      > Roman
                      >
                    • Roman Rokytskyy
                      ... Good. ... Can you provide the DB size as well as parameters that you specify to the command line utility. Roman
                      Message 10 of 10 , Jan 18, 2010
                      • 0 Attachment
                        > Now it works. There was another process connected to embedded DB.

                        Good.

                        > But if I try to restore db from backup file, then DB is not more accessible.
                        > I also tried to restore db with gbak utilities but I have this output:
                        >
                        >>> Done with volume #1,>>"C:\NetBeansProjects\Ladon7\ladon7code\update\restoreLadonD
                        >>> B.fbk" Press return to reopen that file, or type a new
                        > name followed by return to open a different file. Name:
                        >
                        > Surely I forget some parameters... it seems that restore process needs something else...

                        Can you provide the DB size as well as parameters that you specify to
                        the command line utility.

                        Roman
                      Your message has been successfully submitted and would be delivered to recipients shortly.