public class FBManager extends java.lang.Object implements FBManagerMBean
In particular, they can be created and dropped using the jboss service lifecycle operations start and stop.
See FBManagerMBean for documentation.
| Constructor and Description |
|---|
FBManager() |
FBManager(GDSType type) |
FBManager(java.lang.String type) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Alias for
FBManagerMBean.stop() |
java.util.Map<ConnectionProperty,java.lang.Object> |
connectionPropertyValues()
An unmodifiable view on the connection properties held by this BaseProperties implementation.
|
void |
createDatabase(java.lang.String fileName,
java.lang.String user,
java.lang.String password)
Create a database with the specified file name, username and password on the specified
server
and port. |
void |
createDatabase(java.lang.String fileName,
java.lang.String user,
java.lang.String password,
java.lang.String roleName)
Create a database with the specified file name, username, password and role on the specified
server
and port. |
void |
dropDatabase(java.lang.String fileName,
java.lang.String user,
java.lang.String password)
Drop a database with the specified file name, username and password on the specified
server
and port. |
void |
dropDatabase(java.lang.String fileName,
java.lang.String user,
java.lang.String password,
java.lang.String roleName)
Drop a database with the specified file name, username, password and role on the specified
server
and port. |
java.lang.String |
getAuthPlugins()
Get the list of authentication plugins to try.
|
java.lang.Boolean |
getBooleanProperty(java.lang.String name)
Retrieves a
boolean property value by name. |
java.lang.String |
getDefaultCharacterSet() |
int |
getDialect() |
java.lang.String |
getFileName() |
java.lang.Boolean |
getForceWrite() |
java.lang.Integer |
getIntProperty(java.lang.String name)
Retrieves an
int property value by name. |
java.lang.String |
getName() |
int |
getPageSize() |
java.lang.String |
getPassword() |
int |
getPort() |
int |
getPortNumber()
Get the port number of the server.
|
java.lang.String |
getProperty(java.lang.String name)
Retrieves a string property value by name.
|
java.lang.String |
getRoleName() |
java.lang.String |
getServer() |
java.lang.String |
getServerName()
Get the hostname or IP address of the Firebird server.
|
java.lang.String |
getState() |
java.lang.String |
getType() |
java.lang.String |
getUser() |
java.lang.String |
getUserName() |
boolean |
isCreateOnStart()
Get if the database will be created when calling
FBManagerMBean.start(). |
boolean |
isDatabaseExists(java.lang.String fileName,
java.lang.String user,
java.lang.String password)
Check if a database exists with the specified file name, username and password on the specified
server
and port. |
boolean |
isDropOnStop()
Get if the database will be created when calling
FBManagerMBean.stop(). |
boolean |
isForceCreate()
Get if the database will be dropped if exists when creating a database.
|
void |
setAuthPlugins(java.lang.String authPlugins)
Sets the authentication plugins to try.
|
void |
setBooleanProperty(java.lang.String name,
java.lang.Boolean value)
Sets a
boolean property by name. |
void |
setCreateOnStart(boolean createOnStart)
Set if the database will be created when calling
FBManagerMBean.start(). |
void |
setDefaultCharacterSet(java.lang.String firebirdCharsetName)
Set the default database character set to use when creating a new database.
|
void |
setDialect(int dialect)
Set the database dialect to use when creating a new database.
|
void |
setDropOnStop(boolean dropOnStop)
Set if the database will be created when calling
FBManagerMBean.stop(). |
void |
setFileName(java.lang.String fileName)
Set the file name or alias of the database.
|
void |
setForceCreate(boolean forceCreate)
Set if the database will be dropped if exists when creating a database.
|
void |
setForceWrite(java.lang.Boolean forceWrite)
Control force write behaviour of the created database.
|
void |
setIntProperty(java.lang.String name,
java.lang.Integer value)
Sets an
int property by name. |
void |
setPageSize(int pageSize)
Set the page size to use when creating a new database.
|
void |
setPassword(java.lang.String password) |
void |
setPort(int port)
Set the port of the Firebird server.
|
void |
setPortNumber(int portNumber)
Set the port number of the server.
|
void |
setProperty(java.lang.String name,
java.lang.String value)
Sets a property by name.
|
void |
setRoleName(java.lang.String roleName) |
void |
setServer(java.lang.String host)
Set the hostname of the Firebird server.
|
void |
setServerName(java.lang.String serverName)
Set the hostname or IP address of the Firebird server.
|
void |
setType(java.lang.String type) |
void |
setUser(java.lang.String user) |
void |
setUserName(java.lang.String userName)
Set the username.
|
void |
start()
Start this manager.
|
void |
stop()
Stop this manager.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetCharSet, getConnectTimeout, getDbCryptConfig, getEncoding, getParallelWorkers, getProcessId, getProcessName, getSocketBufferSize, getSoTimeout, getWireCrypt, isWireCompression, setCharSet, setConnectTimeout, setDbCryptConfig, setEncoding, setParallelWorkers, setProcessId, setProcessName, setSocketBufferSize, setSoTimeout, setWireCompression, setWireCryptgetBooleanProperty, getIntProperty, getPropertypublic FBManager()
public FBManager(GDSType type)
public FBManager(java.lang.String type)
public void start()
throws java.lang.Exception
FBManagerMBean
If FBManagerMBean.isCreateOnStart() is true, will attempt to create a new database specified using
the server, port, fileName and related properties. If the specified already exists,
nothing will be created unless FBManagerMBean.isForceCreate() is true. When forceCreate is true
an attempt will be made to drop the database.
start in interface FBManagerMBeanjava.lang.IllegalStateException - If this manager is not startedjava.lang.Exception - For failures to start or create the databasepublic void stop()
throws java.lang.Exception
FBManagerMBean
If FBManagerMBean.isDropOnStop() is true, will attempt to drop the database specified using the server,
port, fileName and related properties,
If the manager is currently stopped, this method will do nothing.
stop in interface FBManagerMBeanjava.lang.Exception - For failures to drop the database.public void close()
throws java.lang.Exception
FBManagerMBeanFBManagerMBean.stop()close in interface java.lang.AutoCloseableclose in interface FBManagerMBeanjava.lang.Exceptionpublic java.lang.String getState()
getState in interface FBManagerMBean"Stopped" or "Started"public java.lang.String getName()
getName in interface FBManagerMBeanpublic void setServerName(java.lang.String serverName)
AttachmentProperties
When set to null (the default), the databaseName or serviceName is used as the full
identification of the database host, port and database path/alias. Protocol implementations, for example
PURE_JAVA, may default to localhost when this property is null, but
databaseName/serviceName does not (seem to) contain a host name.
setServerName in interface AttachmentPropertiesserverName - Hostname or IP address of the serverpublic java.lang.String getServerName()
AttachmentPropertiesgetServerName in interface AttachmentPropertiesAttachmentProperties.setServerName(String)public void setServer(java.lang.String host)
FBManagerMBeansetServer in interface FBManagerMBeanhost - hostnameAttachmentProperties.setServerName(String)public java.lang.String getServer()
getServer in interface FBManagerMBean"localhost")AttachmentProperties.setServerName(String)public void setPortNumber(int portNumber)
AttachmentProperties
Defaults to 3050. This property value will be ignored if serverName is null, unless the
protocol implementation needs a hostname, but cannot find a hostname in databaseName/serviceName.
setPortNumber in interface AttachmentPropertiesportNumber - Port number of the serverAttachmentProperties.setServerName(String)public int getPortNumber()
AttachmentPropertiesgetPortNumber in interface AttachmentPropertiesAttachmentProperties.setPortNumber(int)public void setPort(int port)
FBManagerMBeansetPort in interface FBManagerMBeanport - port of the Firebird serverAttachmentProperties.setPortNumber(int)public int getPort()
getPort in interface FBManagerMBean3050)AttachmentProperties.getPortNumber()public java.lang.String getFileName()
getFileName in interface FBManagerMBeanpublic void setFileName(java.lang.String fileName)
FBManagerMBeansetFileName in interface FBManagerMBeanfileName - File name or alias of the databasepublic java.lang.String getType()
getType in interface AttachmentPropertiespublic void setType(java.lang.String type)
setType in interface AttachmentPropertiestype - type of the connection, for example, "PURE_JAVA", "NATIVE", "EMBEDDED", depends on the GDS
implementations installed in the system.public java.lang.String getUser()
getUser in interface AttachmentPropertiespublic void setUser(java.lang.String user)
setUser in interface AttachmentPropertiesuser - Name of the user to authenticate to the server.public java.lang.String getUserName()
getUserName in interface FBManagerMBeanAttachmentProperties.getUser()public void setUserName(java.lang.String userName)
FBManagerMBeansetUserName in interface FBManagerMBeanuserName - usernameAttachmentProperties.setUser(String)public java.lang.String getPassword()
getPassword in interface AttachmentPropertiespublic void setPassword(java.lang.String password)
setPassword in interface AttachmentPropertiespassword - Password to authenticate to the server.public java.lang.String getRoleName()
getRoleName in interface AttachmentPropertiespublic void setRoleName(java.lang.String roleName)
setRoleName in interface AttachmentPropertiesroleName - SQL role to use.public java.lang.String getAuthPlugins()
AttachmentPropertiesgetAuthPlugins in interface AttachmentPropertiespublic void setAuthPlugins(java.lang.String authPlugins)
AttachmentPropertiesInvalid names are skipped during authentication.
setAuthPlugins in interface AttachmentPropertiesauthPlugins - comma-separated list of authentication pluginspublic void setDialect(int dialect)
FBManagerMBeansetDialect in interface FBManagerMBeandialect - Database dialect (1 or 3)FBManagerMBean.getDialect()public int getDialect()
getDialect in interface FBManagerMBeanpublic void setPageSize(int pageSize)
FBManagerMBean
The value for pageSize must be one of PageSizeConstants. The default value depends on the
Firebird version.
Some values are not valid on all Firebird versions.
setPageSize in interface FBManagerMBeanpageSize - The page size to be used in the created database, see PageSizeConstantsPageSizeConstantspublic int getPageSize()
getPageSize in interface FBManagerMBean-1 if the database default is used.public void setDefaultCharacterSet(java.lang.String firebirdCharsetName)
FBManagerMBeansetDefaultCharacterSet in interface FBManagerMBeanfirebirdCharsetName - Character set name, use Firebird names only; null will use Firebird default (NONE).
Specifying an invalid name will result in an exception during database creation.public java.lang.String getDefaultCharacterSet()
getDefaultCharacterSet in interface FBManagerMBeannull means not set.FBManagerMBean.setDefaultCharacterSet(String)public void setForceWrite(java.lang.Boolean forceWrite)
FBManagerMBean
Only use this method if you know what you're doing, and if you can live with data loss and database corruption.
In general it is advisable to use the Firebird default (null for this method).
setForceWrite in interface FBManagerMBeanforceWrite - null - default behaviour (force write enabled after database creation and initialization),
true - enable force write at database creation,
false - disable force writepublic java.lang.Boolean getForceWrite()
getForceWrite in interface FBManagerMBeanFBManagerMBean.setForceWrite(Boolean)public boolean isCreateOnStart()
FBManagerMBeanFBManagerMBean.start().isCreateOnStart in interface FBManagerMBeantrue when the database will be created on start, false otherwise.public void setCreateOnStart(boolean createOnStart)
FBManagerMBeanFBManagerMBean.start().setCreateOnStart in interface FBManagerMBeancreateOnStart - true to create the database on start, false to not create on start (default)public boolean isDropOnStop()
FBManagerMBeanFBManagerMBean.stop().isDropOnStop in interface FBManagerMBeantrue to drop the database on stop, false otherwisepublic void setDropOnStop(boolean dropOnStop)
FBManagerMBeanFBManagerMBean.stop().setDropOnStop in interface FBManagerMBeandropOnStop - true to drop the database on stop, false to not drop on stop (default)public boolean isForceCreate()
FBManagerMBeanisForceCreate in interface FBManagerMBeantrue to drop existing database on create, false to not create a database if it exists.public void setForceCreate(boolean forceCreate)
FBManagerMBeansetForceCreate in interface FBManagerMBeanforceCreate - true to drop existing database on create, false to not create a database if it exists.public void createDatabase(java.lang.String fileName,
java.lang.String user,
java.lang.String password)
throws java.lang.Exception
FBManagerMBeanserver
and port.
On creation, the following properties will used to configure the database: dialect, pageSize,
defaultCharacterSet.
If the database already exists, and forceCreate is true, the database will be dropped. If
false, no database will be created.
createDatabase in interface FBManagerMBeanfileName - Database file name or aliasuser - User namepassword - Passwordjava.lang.IllegalStateException - If this manager is not startedjava.lang.Exception - If database creation fails.public void createDatabase(java.lang.String fileName,
java.lang.String user,
java.lang.String password,
java.lang.String roleName)
throws java.lang.Exception
FBManagerMBeanserver
and port.
On creation, the following properties will used to configure the database: dialect, pageSize,
defaultCharacterSet.
If the database already exists, and forceCreate is true, the database will be dropped. If
false, no database will be created.
createDatabase in interface FBManagerMBeanfileName - Database file name or aliasuser - User namepassword - PasswordroleName - Role name (or null for no role)java.lang.IllegalStateException - If this manager is not startedjava.lang.Exception - If database creation fails.public void dropDatabase(java.lang.String fileName,
java.lang.String user,
java.lang.String password)
throws java.lang.Exception
FBManagerMBeanserver
and port.dropDatabase in interface FBManagerMBeanfileName - Database file name or aliasuser - User namepassword - Passwordjava.lang.Exception - If this manager is not started or database drop fails.public void dropDatabase(java.lang.String fileName,
java.lang.String user,
java.lang.String password,
java.lang.String roleName)
throws java.lang.Exception
FBManagerMBeanserver
and port.dropDatabase in interface FBManagerMBeanfileName - Database file name or aliasuser - User namepassword - PasswordroleName - Role name (or null for no role)java.lang.Exception - If this manager is not started or database drop fails.public boolean isDatabaseExists(java.lang.String fileName,
java.lang.String user,
java.lang.String password)
throws java.lang.Exception
FBManagerMBeanserver
and port.
Existence is checked by connecting to the database, so any connection error, including invalid credentials, will report the database as not existing.
isDatabaseExists in interface FBManagerMBeanfileName - Database file name or aliasuser - User namepassword - Passwordtrue if the database exists and can be connected, false if the database does not exist
or any other error occurred.java.lang.Exception - Currently no other exception is thrown, this may change in the futurepublic final java.lang.String getProperty(java.lang.String name)
BaseProperties
For properties with an explicit default, this method should return the string presentation of that default, not
null. For int or boolean the string equivalent is returned.
getProperty in interface BasePropertiesname - Property name (not null or empty)null when not set or not a known propertypublic final void setProperty(java.lang.String name,
java.lang.String value)
BaseProperties
This method can be used to set all defined properties, but also properties not known by Jaybird. When setting
int or boolean properties, the appropriate conversions are applied. Using null will
reset to the default value. For boolean properties, an empty string is taken to mean true.
setProperty in interface BasePropertiesname - Property name (not null or empty)value - Property value (use null to apply default)public final java.lang.Integer getIntProperty(java.lang.String name)
BasePropertiesint property value by name.
For properties with an explicit default, this method should return the integer presentation of that default. For
implementation simplicity, it is allowed to convert any string property to int instead of checking if
something is actually an int property
getIntProperty in interface BasePropertiesname - Property name (not null or empty)null when not setpublic final void setIntProperty(java.lang.String name,
java.lang.Integer value)
BasePropertiesint property by name.
For implementation simplicity, it is allowed to also set string properties. The value set will be the string equivalent.
setIntProperty in interface BasePropertiesname - Property name (not null or empty)value - Property value (use null to apply default)public final java.lang.Boolean getBooleanProperty(java.lang.String name)
BasePropertiesboolean property value by name.
For properties with an explicit default, this method should return the boolean presentation of that default. For
implementation simplicity, it is allowed to convert any string property to boolean instead of checking
if something is actually an int property
getBooleanProperty in interface BasePropertiesname - Property name (not null or empty)null when not setpublic final void setBooleanProperty(java.lang.String name,
java.lang.Boolean value)
BasePropertiesboolean property by name.
For implementation simplicity, it is allowed to also set string properties. The value set will be the string equivalent.
setBooleanProperty in interface BasePropertiesname - Property name (not null or empty)value - Property value (use null to apply default)public final java.util.Map<ConnectionProperty,java.lang.Object> connectionPropertyValues()
BaseProperties
Be aware, implementations can have additional properties that are not mapped from ConnectionProperty.
Such properties will need to be retrieved in an implementation-specific manner.
connectionPropertyValues in interface BasePropertiesCopyright © 2001-2025 Jaybird (Firebird JDBC) team. All rights reserved.