SmartfoxServer and Database Communication Setup

We Can configure the database in SmartfoxServer 2x in two ways

  1. Using Admin Panel
  2. Direct Editing of .zone.xml file

> Database Configuration Using Admin Panel

  • Step 1:- Configure the databaseManager under the zone in order to establish the communication between extension and database.
  • Step 2:- Open zone file using AdminPanel and configure the database tab as adminpanel
    adminpanel's DataBase Manager TAB
  • Step 3:- In the above Database manager tab we need to fill the fields, initially those are empty or filled with the data available in .zone.xml file.
  • Step 4:- Fields And There details
    FieldName Description
    Activate Indicates the database connection is active or not for the current zone. If we want allow Database connection to the current zone it must be in enable mode.(so enable it now)
    Database Driver Class Qualified Name Of the driver class.
    The driver class jar need to be placed in either SFS2x\lib folder or SFS2X\extensions\__lib folder.
    Some Driver class details are
    For Mysql :- com.mysql.jdbc.Driver
    For SQLServer :-
    For Oracle :- oracle.jdbc.driver.OracleDriver
    ConnectionString JDBC Connection String with port,host and database details.
    • Example Connection Strings
    • Mysql :- jdbc:mysql://host:port/database
    • SQLServer :- jdbc:sqlserver://host:port;databaseName=databasename
    • Oracle :- jdbc:oracle:oci:@host:port:databasename
    Username Username for the above mentioned connection string
    Password Password for the above mentioned user's related to above mentioned connection string
    Test SQL SmartfoxServer will fires this test sql when the connection established (it is optional)
    Max Active Connections Indicates Max No Of Active Connections in Connection Pool
    Max Idle Connections Indicates Max No of Idle connections in the Connection Pool
    Exhausted Pool Connections Indicates what to do if the Max Number of Connections are opened and a new open connection arrives
    FAIL - rejects new connection
    BLOCK - holds the open connection request for sometime
    GROW - will create more connections if the max connection are opened(prefered)
  • Step 5:- Press the submit and reload buttons


trace() method is similar to System.out.println() it will echos the msg to console as well as log file.

> Database Configuration Using .zone.xml file

  • Step 1:- Open the concerned .zone.xml file in any text editor.
    In SFS2X folder we will have a 'zones' folder in that our zone file will be there open it in any text editor (SFS2x->zones->
  • Step 2:- Find/Search the tag <databaseManager> and edit like this (sample mysql driver details are mentioned here fill with your db related entries there, for more about tags description check this link
<databaseManager active="true">
    <testSql>select now()</testSql>
Copyright © 2018-2020 TutorialToUs. All rights reserved.