Main Content

Integrate MATLAB Online Server with Database Toolbox

Intended Audience

IT administrators configuring Database Toolbox™ for end users. For information on using Database Toolbox in the MATLAB® Online Server™ environment, see Perform Database Queries in MATLAB Online Hosted by Your Organization.

Using Database Toolbox, your MATLAB Online™ end users can connect to a JDBC-compliant databases to execute queries. To enable communication with the database, you must update the MATLAB Online Server configuration in the MATLAB pool override file.

Prerequisites

  1. You installed MATLAB Online Server and installed MATLAB on the server.

  2. You installed the Database Toolbox product on the server. For instructions, see Install Add-Ons for MATLAB on MATLAB Online Server.

  3. You have database host and port information so that you can properly configure the backend. Many database vendors have a default port, but it is possible that this port is different in your environment.

Basic Configuration

By default, MATLAB Online Server allows the MATLAB process access to the minimum number of network ports required for it to run properly. To enable interactions with an external database, update the configuration YAML files to allow egress from the Kubernetes® cluster to the desired resource.

  1. Update the matlab-pool.yaml overrides file with the required port information for this database. Make your changes in the networkPolicy section of the YAML file. For more details, see Configure Network Policies. For example:

    networkPolicy:
      enabled: true
      additionalAllowedPorts:
        # allow MySQL access on standard port
        - port: 3306
          protocol: "TCP"
        - port: 3306
          protocol: "UDP"
        # Specify any additional port configurations
    
  2. Deploy the change to the cluster using the following command. Replace <namespace-name> with your MATLAB Online Server namespace.

    ./mosadm upgrade matlab-pool --namespace <namespace-name>
  3. Validate the change by confirming that your changes appear in the Kubernetes network policy. To view this network policy, run this command, replacing <namespace-name> with your MATLAB Online Server namespace.

    kubectl describe networkPolicy --namespace <namespace-name>

Custom Configuration

To specify a custom configuration, provide a storage mount for all MATLAB Online users with read-only drivers. You can make version-specific drivers for your environment readily available to your end users. To create a read-only mount that contains JDBC drivers for your MATLAB Online Server installation, see NFS configuration.

End-User Support

After you integrate MATLAB with Database Toolbox, provide end users with information on connecting to their database. See Perform Database Queries in MATLAB Online Hosted by Your Organization.

Related Topics