Step 1: Download the Connector/J  

Step 2: Find the MATLAB Preferences Directory

  • Open MATLAB
  • At the >> prompt within matlab type in prefdir and hit enter
  • Copy the ans = path and open it in a new Windows Explorer window
    The path should look something like: '/Users/username/Library/Application Support/MathWorks/MATLAB/R2018b'
  • Create a text file at this location named  javaclasspath.txt   (NOTE: DO NOT USE TextEdit.app on MacOS it is not a raw text editor and will insert extraneous meta data breaking the txt file. use Visual Studio Code or other preferred RAW txt editor.)
  • Open the javaclasspath.txt file and insert the path to the connector file
    For example: /Users/Shared/jconnectors/mysql-connector-java-5.1.47.jar

Step 3: Establish the JDBC Connection


  • On the right side of the Apps ribbon, click the drop down arrow to view all apps. Scroll down to the Database Connectivity and Reporting selection and click Database Explorer

  • You may be prompted to connect to a data source. Click Cancel to disregard this
  • Click the New+ or  Configure Data Source (version dependent) icon at the top left of the Database Explorer Window and select Configure JDBC

The JDBC Data Source Configuration window will appear.

  • In the Name field enter a connection name  you would like to use to define this connection. Ie: BrainDBConn

  • From the vendor selection options choose MYSQL

  • Connection Parameters

    • Database = the exact name of your database as it appears in MariaDB / phpMyAdmin

    • Server = the Fully Qualified Domain Name of your database server

    • Port Number = 3307   (Note: traditionally MySQL uses 3306, however with MariaDB 10 on Synology the default ports is now 3307) 


Click the Test button to make sure your settings are correct. If the test returns connection, then click Save.



Fixing the JDBC Driver Error: Time Zone

Specified UTC as the TimeZone argument

conn = database('TABLENAME','USERNAME','PASSWORD','com.mysql.jdbc.Driver','jdbc:mysql://SERVERNAME:3307/?serverTimezone=UTC&')