Overcast Docs / BasicOperations / database-connection
» Database connection
Once you have deployed a database server you can connect one or more SmartFoxServer instances to it by configuring the details in your Zone, via the AdminTool.
If you're not familiar with the basics of connecting SFS2X to a database we highly recommend to review the SmartFoxServer documentation here.
» Setting up the connection
Connect to your SmartFox instance via the AdminTool, select the Zone Configurator module and click the Database Manager tab.
Proceed with completing the fields as in the picture:
- Database driver class: org.mariadb.jdbc.Driver
- Connection string: jdbc:mariadb://<database-private-ip>:3306/<database-name>
- Username: root
- Password: the password you have chosen
- Test SQL: a valid SQL statement used to check the connection state
- Exhausted pool action: GROW
Finally hit the Submit button and restart SFS2X for the changes to be activated.
» Choosing the MySQL connector
Out of the box we install the MariaDB JDBC connector which is an alternative JDBC driver to the official MySQL connector and which comes with an LGPL license. This allows us to avoid licensing issues when distributing the library with SmartFoxServer 2X.
On the other hand, the official MySQL JDBC Driver comes with a GPL license and can be installed by the customer, if necessary.
If your project requires the official driver you can download the jar file from the link above and upload it to your SmartFoxServer instance via the AdminTool > Extension Manager under the __lib__/ folder
Just select the __lib__ folder, hit the upload icon and browse the local disk for the driver's jar file.
When using the MySQL connector the same settings as above can be used with the exception of the following:
- Database driver class: com.mysql.jdbc.Driver
- Connection string: jdbc:mysql://<database-private-ip>:3306/<database-name>