Subject Re: [Firebird-Java] Get the database page size from Jaybird
Author Gabriel Reid
On Thu, Nov 09, 2006 at 04:13:52PM -0000, Bill Oliver wrote:
> Any way to get the databas page size from Jaybird?
>
> Really, my first thought was that the page size should be a column in
> the RDB$DATABASE table, and then I could query it directly, but this
> does not seem to be the case.
>
> The reason I ask, is that a user wants to ensure that the DBA creates
> the database with page size of 16K, to take advantage of larger index
> size. He would like to query the value and throw an error if it is not
> 16k.
>
> I told him to try and create his index within a TRY/CATCH block. If
> the index creation fails, catch the error and check the SQL CODE, to
> see if page size was too small. This approach was deemed to lack a
> certain amount of elegance, though.

Another way of getting it (although I'm not sure if it's any more
elegant than the method you describe) is to use the FBStatisticsManager.
Calling the getHeaderPage() method will output the gstat header page
information to whatever logging stream you've set for the
StatisticsManager, and this text stream includes the page size for the
database.

The drawback is that this means you still have to find the page size
value in the string that is output; not really hard, but also not really
clean.

- Gabriel