Package com.smartfoxserver.db
Class DBConfig
java.lang.Object
com.smartfoxserver.db.DBConfig
- All Implemented Interfaces:
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanToggles the DBManagerThe connection string to the database, according to the JDBC standard notation.Fully qualified name of the database driver, for example com.mysql.jdbc.DriverintLeave this disabled (set to zero) unless you really know what you're doing.intThe maximum number of active connections in the connection pool A default value of 10 should be enough for most high traffic scenarios.The password for accessing the databaseA test SQL expression that will be executed at startup to verify the integrity of the setup and connectionThe user name for accessing the database -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionMethod used by AdminTool extension to hide password sent to the client via descriptor.
-
Field Details
-
active
public boolean activeToggles the DBManager -
driverName
Fully qualified name of the database driver, for example com.mysql.jdbc.Driver -
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
The user name for accessing the database -
password
The password for accessing the database -
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 maxActiveConnectionsThe maximum number of active connections in the connection pool A default value of 10 should be enough for most high traffic scenarios. Don't be tempted to use a very high value as it will only degrade performance.For more info please refer to this article: https://github.com/brettwooldridge/HikariCP/wiki/About-Pool-Sizing
-
keepAliveMinutes
public int keepAliveMinutesLeave this disabled (set to zero) unless you really know what you're doing. See relative docs: https://github.com/brettwooldridge/HikariCP?tab=readme-ov-file#essentials
-
-
Constructor Details
-
DBConfig
public DBConfig()
-
-
Method Details
-
getPwdPlaceholder
Method used by AdminTool extension to hide password sent to the client via descriptor.
-