Class DBConfig

java.lang.Object
com.smartfoxserver.db.DBConfig
All Implemented Interfaces:
Serializable

public class DBConfig extends Object implements 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

    Fields
    Modifier and Type
    Field
    Description
    boolean
    Toggles the DBManager
    The connection string to the database, according to the JDBC standard notation.
    Fully qualified name of the database driver, for example com.mysql.jdbc.Driver
    int
    Leave this disabled (set to zero) unless you really know what you're doing.
    int
    The 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 database
    A test SQL expression that will be executed at startup to verify the integrity of the setup and connection
    The user name for accessing the database
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Method used by AdminTool extension to hide password sent to the client via descriptor.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • active

      public boolean active
      Toggles the DBManager
    • driverName

      public String driverName
      Fully qualified name of the database driver, for example com.mysql.jdbc.Driver
    • connectionString

      public 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 String userName
      The user name for accessing the database
    • password

      public String password
      The password for accessing the database
    • testSql

      public String testSql
      A test SQL expression that will be executed at startup to verify the integrity of the setup and connection

      It 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 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 keepAliveMinutes
      Leave 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

      public String getPwdPlaceholder()
      Method used by AdminTool extension to hide password sent to the client via descriptor.