Subject Re: [Firebird-Java] Re: How is it possible to change Page_Size to 2048 ?
Author Gabriel Reid
> If you use iSQL,
> you can send
> > > Create Database 'NewDB.fdb' user 'sysdba' password 'masterkey'
> > > page_size 2048
>
> in above case, we are creating new Database with specified Page_Size
> (so that it does not use the DEFAULT PAGE_SIZE).
>
> I want to know if it is possible to do same thing, but in Java.
>
> My other question is that
> can I send CREATE DATABASE statement from Java is the database does
> not yet exist?

You can create a database using the org.firebirdsql.management.FBManager; however, that
doesn't give you the option of setting the pagesize.

It is possible to set the page size of a database before you create it
from Java if you use the GDS implementations directly; however, I'd say
that the easiest way to do this at the moment with the current API is
the backup and restore method as I explained in the previous message.


- Gabriel





> --- In Firebird-Java@yahoogroups.com, Gabriel Reid <gabriel.reid@...>
> wrote:
> >
> > On Mon, Nov 13, 2006 at 08:51:25PM -0000, Ashok122 wrote:
> > > I want to do this in Java.
> > >
> > > But I am not sure about getting a Connection object without Database
> > > is first created.
> > >
> > > Because it is possible to use executeUpdate with
> > > Create Database 'NewDB.fdb' user 'sysdba' password 'masterkey'
> > > page_size 2048
> > >
> > > before I can use above statement, I need to get the Connection to the
> > > database which does not yet exist.
> > >
> > > or
> > >
> > > If someone knows how to do this using Service API / FBBackupManager, I
> > > would appreciate the Source Code example.
> > >
> >
> > You can indeed do it with the FBBackupManager. The following code should
> > do it:
> >
> > BackupManager mgr = new FBBackupManager();
> > mgr.setUser("sysdba");
> > mgr.setPassword("masterkey");
> > mgr.setHost("somehost");
> > mgr.setVerbose(true);
> > mgr.setLogger(System.out);
> > mgr.setDatabase("/path/to/db.fdb");
> > mgr.setBackupPath("/tmp/backed_up.fbk");
> > mgr.backupDatabase();
> > mgr.setRestorePageSize(2048);
> > mgr.setRestoreReplace(true);
> > mgr.restoreDatabase();
> >
> >
> > - Gabriel
> >
>
>
>