Multiple DB connections

There can be cases in which one application requires to connect to multiple databases. By default each Zone in SFS2X exposes a single DBManager object but we can create more of these via code, to manage multiple data sources.

We highly recommend to create all of the required DBManager instances in the init() method of your Extension. This is an example of how to create a DBManager via code:

public class MultiDBExtension extends SFSExtension
    private SFSDBManager dbm;

    public void init()
        // Prepare DBManager configuration
        DBConfig cfg = new DBConfig(); = true;
        cfg.driverName = "com.mysql.jdbc.Driver";
        cfg.connectionString = "jdbc:mysql://";
        cfg.userName = "db_user_name";
        cfg.password = "db_user_pass";
        cfg.testSql = "SELECT name FROM some_table LIMIT 1";

        //... more settings ...

        // Create DBManager
        dbm = new SFSDBManager(cfg);

For more details you can check tha server side Javadoc: