Search in sources :

Example 21 with FbService

use of org.firebirdsql.gds.ng.FbService in project jaybird by FirebirdSQL.

the class FBMaintenanceManager method setDatabaseAccessMode.

public void setDatabaseAccessMode(int mode) throws SQLException {
    if (mode != ACCESS_MODE_READ_WRITE && mode != ACCESS_MODE_READ_ONLY) {
        throw new IllegalArgumentException("mode must be one of ACCESS_MODE_READ_WRITE or ACCESS_MODE_READ_ONLY");
    }
    try (FbService service = attachServiceManager()) {
        ServiceRequestBuffer srb = createDefaultPropertiesSRB(service);
        srb.addArgument(isc_spb_prp_access_mode, (byte) mode);
        executeServicesOperation(service, srb);
    }
}
Also used : ServiceRequestBuffer(org.firebirdsql.gds.ServiceRequestBuffer) FbService(org.firebirdsql.gds.ng.FbService)

Example 22 with FbService

use of org.firebirdsql.gds.ng.FbService in project jaybird by FirebirdSQL.

the class FBMaintenanceManager method executePropertiesOperation.

/**
 * Execute a isc_spb_prp_* (properties) services operation.
 *
 * @param operation
 *         The identifier for the operation to be executed
 * @throws SQLException
 *         if a database access error occurs
 */
private void executePropertiesOperation(int operation) throws SQLException {
    try (FbService service = attachServiceManager()) {
        ServiceRequestBuffer srb = createPropertiesSRB(service, operation);
        executeServicesOperation(service, srb);
    }
}
Also used : ServiceRequestBuffer(org.firebirdsql.gds.ServiceRequestBuffer) FbService(org.firebirdsql.gds.ng.FbService)

Example 23 with FbService

use of org.firebirdsql.gds.ng.FbService in project jaybird by FirebirdSQL.

the class FBMaintenanceManager method setDefaultCacheBuffer.

public void setDefaultCacheBuffer(int pageCount) throws SQLException {
    if (pageCount != 0 && pageCount < 50) {
        throw new IllegalArgumentException("page count must be 0 or >= 50, value was: " + pageCount);
    }
    try (FbService service = attachServiceManager()) {
        ServiceRequestBuffer srb = createDefaultPropertiesSRB(service);
        srb.addArgument(isc_spb_prp_page_buffers, pageCount);
        executeServicesOperation(service, srb);
    }
}
Also used : ServiceRequestBuffer(org.firebirdsql.gds.ServiceRequestBuffer) FbService(org.firebirdsql.gds.ng.FbService)

Example 24 with FbService

use of org.firebirdsql.gds.ng.FbService in project jaybird by FirebirdSQL.

the class FBMaintenanceManager method bringDatabaseOnline.

public void bringDatabaseOnline(byte operationMode) throws SQLException {
    if (operationMode != OPERATION_MODE_NORMAL && operationMode != OPERATION_MODE_MULTI && operationMode != OPERATION_MODE_SINGLE) {
        throw new IllegalArgumentException("Operation mode must be " + "one of: OPERATION_MODE_NORMAL, OPERATION_MODE_MULTI, OPERATION_MODE_SINGLE");
    }
    try (FbService service = attachServiceManager()) {
        ServiceRequestBuffer srb = createDefaultPropertiesSRB(service);
        srb.addArgument(isc_spb_prp_online_mode, operationMode);
        executeServicesOperation(service, srb);
    }
}
Also used : ServiceRequestBuffer(org.firebirdsql.gds.ServiceRequestBuffer) FbService(org.firebirdsql.gds.ng.FbService)

Example 25 with FbService

use of org.firebirdsql.gds.ng.FbService in project jaybird by FirebirdSQL.

the class FBMaintenanceManager method setDatabaseDialect.

public void setDatabaseDialect(int dialect) throws SQLException {
    if (dialect != 1 && dialect != 3) {
        throw new IllegalArgumentException("dialect must be either 1 or 3");
    }
    try (FbService service = attachServiceManager()) {
        ServiceRequestBuffer srb = createDefaultPropertiesSRB(service);
        srb.addArgument(isc_spb_prp_set_sql_dialect, dialect);
        executeServicesOperation(service, srb);
    }
}
Also used : ServiceRequestBuffer(org.firebirdsql.gds.ServiceRequestBuffer) FbService(org.firebirdsql.gds.ng.FbService)

Aggregations

FbService (org.firebirdsql.gds.ng.FbService)29 ServiceRequestBuffer (org.firebirdsql.gds.ServiceRequestBuffer)20 SQLException (java.sql.SQLException)6 Test (org.junit.Test)1