Matlab + JDBC ConnectorJ + MariaDB on Windows

  1. Knowledge Base
  2. Data Management
  3. Matlab + JDBC ConnectorJ + MariaDB on Windows

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: “C:\Users\USERNAME\AppData\Roaming\MathWorks\MATLAB\R####”
  • Create a text file at this location named javaclasspath.txt  
  • Open the javaclasspath.txt   file and insert the path to the respective connector file:
    For example: c:\connectors\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.

Leave a Reply

Your email address will not be published. Required fields are marked *