Package com.smartfoxserver.v2.db
Class DBConfig
- java.lang.Object
-
- com.smartfoxserver.v2.db.DBConfig
-
- All Implemented Interfaces:
java.io.Serializable
public class DBConfig extends java.lang.Object implements java.io.Serializable
The DBConfig class describes all the settings necessary to setup a JDBC connection to the database and to configure the connection pool.The configuration can be easily done via the visual AdminTool provided in SmartFoxServer 2X, however you might want to create these objects manually via code when your application requires to connect to multiple databases.
- See Also:
SFSDBManager
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description boolean
active
Toggles the DBManagerint
blockTime
The amount of time to block if the BLOCK option is chosen for the exhaustedPoolAction settingjava.lang.String
connectionString
The connection string to the database, according to the JDBC standard notation.java.lang.String
driverName
Fully qualified name of the database driver, for example com.mysql.jdbc.Driverjava.lang.String
exhaustedPoolAction
The action that should be executed when the connection pool is exhausted.int
maxActiveConnections
The maximum number of active connections in the connection poolint
maxIdleConnections
The maximum number of idle connections in the connection pooljava.lang.String
password
The password for accessing the databasestatic java.lang.String
POOL_ACTION_BLOCK
static java.lang.String
POOL_ACTION_FAIL
static java.lang.String
POOL_ACTION_GROW
java.lang.String
testSql
A test SQL expression that will be executed at startup to verify the integrity of the setup and connectionjava.lang.String
userName
The user name for accessing the database
-
Constructor Summary
Constructors Constructor Description DBConfig()
-
-
-
Field Detail
-
POOL_ACTION_FAIL
public static final java.lang.String POOL_ACTION_FAIL
- See Also:
- Constant Field Values
-
POOL_ACTION_BLOCK
public static final java.lang.String POOL_ACTION_BLOCK
- See Also:
- Constant Field Values
-
POOL_ACTION_GROW
public static final java.lang.String POOL_ACTION_GROW
- See Also:
- Constant Field Values
-
active
public boolean active
Toggles the DBManager
-
driverName
public java.lang.String driverName
Fully qualified name of the database driver, for example com.mysql.jdbc.Driver
-
connectionString
public java.lang.String connectionString
The connection string to the database, according to the JDBC standard notation.You can read more about this here: http://download.oracle.com/javase/tutorial/jdbc/basics/connecting.html
-
userName
public java.lang.String userName
The user name for accessing the database
-
password
public java.lang.String password
The password for accessing the database
-
testSql
public java.lang.String testSql
A test SQL expression that will be executed at startup to verify the integrity of the setup and connectionIt is recommended to use very simple SQL code such as SELECT count(*) FROM users or a similar quick SQL query.
-
maxActiveConnections
public int maxActiveConnections
The maximum number of active connections in the connection pool
-
maxIdleConnections
public int maxIdleConnections
The maximum number of idle connections in the connection pool
-
exhaustedPoolAction
public java.lang.String exhaustedPoolAction
The action that should be executed when the connection pool is exhausted.
There are three main options:- FAIL: an exception is thrown and no more connections are allowed
- GROW: the pool size is enlarged to accomodate the new exceeding requests. This might in turn will instantiate more resources.
- BLOCK: block the thread for a while and retry
-
blockTime
public int blockTime
The amount of time to block if the BLOCK option is chosen for the exhaustedPoolAction setting
-
-