Класс FBManager
предназначен для создания (или удаления) базы данных, размер страницы для создания базы данных.
В интерфейсе FirebirdDatabaseMetaData
доступны следующие методы:
/**
* Get the major version of the ODS (On-Disk Structure) of the database.
*
* @return The major version number of the database itself
* @exception SQLException if a database access error occurs
*/
int getOdsMajorVersion() throws SQLException;
/**
* Get the minor version of the ODS (On-Disk Structure) of the database.
*
* @return The minor version number of the database itself
* @exception SQLException if a database access error occurs
*/
int getOdsMinorVersion() throws SQLException;
/**
* Get the dialect of the database.
*
* @return The dialect of the database
* @throws SQLException if a database access error occurs
* @see #getConnectionDialect()
*/
int getDatabaseDialect() throws SQLException;
/**
* Get the dialect of the connection.
* <p>
* The connection dialect may be different from the database dialect.
* </p>
*
* @return The dialect of the connection
* @throws SQLException if a database access error occurs
* @see #getDatabaseDialect()
*/
int getConnectionDialect() throws SQLException;
Чтобы получить к ним доступ, вам нужно развернуть объект метаданных базы данных:
Connection connection = ...
FirebirdDatabaseMetaData fbmd = connection.getMetaData().unwrap(FirebirdDatabaseMetaData.class);
int odsMajorVersion = fbmd.getOdsMajorVersion();
// etc
Насколько я помню, размер страницы нигде не указывается. Отправьте запрос на улучшение на http://tracker.firebirdsql.org/browse/JDBC.
И если вы действительно хотите возиться с внутренностями, вы всегда можете использовать новый внутренний API, но он должен считаться нестабильным и может измениться в любой момент (и он может стать недоступным или более сложным для доступа в Java 9 в будущих версиях в зависимости от как мы будем реализовывать поддержку модулей).
Предупреждение: я набрал это без компиляции и тестирования:
Connection connection = ...
FbDatabase db = connection.unwrap(FirebirdConnection.class).getFbDatabase();
byte[] info = db.getDatabaseInfo(new byte[] { ISCConstants.isc_info_page_size }, 20);
if (info[0] == ISCConstants.isc_info_page_size) {
int valueLength = VaxEncoding.iscVaxInteger2(info, 1);
int pageSize = VaxEncoding.iscVaxInteger(info, 3, valueLength);
// ...
}
Или, альтернативно, используя его родного брата
/**
* Request database info.
*
* @param requestItems
* Array of info items to request
* @param bufferLength
* Response buffer length to use
* @param infoProcessor
* Implementation of {@link InfoProcessor} to transform
* the info response
* @return Transformed info response of type T
* @throws SQLException
* For errors retrieving or transforming the response.
*/
<T> T getDatabaseInfo(byte[] requestItems, int bufferLength, InfoProcessor<T> infoProcessor) throws SQLException;
См. рабочий пример в FBStatisticsManager
Отказ от ответственности: я поддерживаю Jaybird.
person
Mark Rotteveel
schedule
04.04.2017