monkeyproof solutions logo
Menu
  • Your challenge
    • Overview

    • Web apps, deployment & integration
    • Refactoring & migration
    • Talent & know-how
    • Efficiency gaps
  • Services
    • Overview

    • Software solutions
    •  ⤷ Scientific coding & optimization
    •  ⤷ Web apps, deployment & integration
    •  ⤷ Software refactoring & migration
    •  ⤷ Cloud adoption & DevOps support
    • Model-based design
    •  ⤷ Modeling & simulation
    •  ⤷ Code generation & integration
    • Talent & know-how
  • Products
    • Overview

    • Simian Web Apps
    • Code Checker for MATLAB
  • About
    • Clients
    • Projects
    • Blog
    • Contact
  1. Products
  2. Database Connector for MATLAB

DB4M - Database Connector for MATLAB

Lower the price-tag

One key goal of the MonkeyProof Database Connector is to lower the expenses associated with database integration in MATLAB workflows. Given the frequent need to interact with databases in our projects, reducing individual user licensing costs for MATLAB's database access was imperative.

Data type mapping

MATLAB's standard Java interface lacks adequate control over converting database types into MATLAB data types. The Database Connector offers complete control through configurable data type mapping, allowing precise handling of both standard JDBC and database-specific types to ensure seamless integration into MATLAB workflows.

Performance

MATLAB's standard Java interface puts a serious constraint on the performance when transporting database data from the Java side to MATLAB. This performance had to be improved. The MonkeyProof Database Connector provides high-performance data transfer via native memory, as well as custom Java-MATLAB, and the standard Java-MATLAB interface.

Maximum fall-back

Providing users with access to underlying Java objects ensures maximum adaptability in managing unexpected behavior and non-standard configurations of JDBC drivers.

Configurability

High configurability is essential to support new database variants effectively. The MonkeyProof Database Connector undergoes rigorous testing with various JDBC drivers, ensuring seamless compatibility across a wide spectrum without encountering issues.

Callable Statements

Numerous database applications benefit from server-side functionality embedded in stored procedures. The MonkeyProof Database Connector offers a feature to extract the calling interface of these procedures and automatically generate MATLAB code, simplifying your workflow.

Robustness

The Database Connector's architecture enables efficient caching of prepared and callable statements. While Java objects are typically lost on a broken connection, the Database Connector retains essential information in MATLAB, facilitating quick re-instantiation of Java Statement objects.

Single Sign-On (SSO)

The Database Connector supports single sign-on for Microsoft SQL Server on Windows.

Code examples

Initially, a straightforward SQL-based quick-start example is presented. Following that, a slightly more advanced illustration demonstrates the utilization of database information to construct the MATLAB Callable Statement object.

Example 1: Getting started

This example includes the code for database connector object creation and clean-up.

% Install the mysql driver specifics once
monkeyproof.database.install('mysql.xml');

% Create a mysql database connector object
% First argument defines the database configuration to use
% Next arguments are self explaining name-value pairs
dbc = monkeyproof.database.jdbc('mysql.xml', ...
 'address',      'myserver.mydomain', ...
 'databaseName', 'mydatabase');

% Just query away
% The connector will ask for your credentials 
q = dbc.query('SELECT * FROM mytable');

% Log off
dbc.exit

% Cleanup
dbc.delete

Example 2: Working with callable statements

This code excludes database object creation and clean-up.

% Create statement based on procName, procSchema, procCatalog
myCallStmt = dbc.createCallStmt('createNewUser', 'dbo', dbc.databaseName)

% Note: A unique identifier 'mydatabase.dbo.createNewUser' has been
% generated from the location of the procedure in the database

% Generate template code for using the callable statement (output not shown)
myCallStmt.getCode()

% Code below (input struct and calling syntax) based on generated template
myNewUser = struct( ...
 'firstname', 'John', ...
 'lastname',  'Doe', ...
 'e_mail',    'john.doe@example.com', ...
 'username',  'john.doe', ...
 'status',    'Active');

% Do the actual call
result = dbc.updateCallStmt('mydatabase.dbo.createNewUser', myNewUser)

Key features

  • Cross-platform (Windows, Linux, Mac)
  • Built on JDBC
  • Optimized for performance
  • Works with multiple database (flavors) in parallel
  • MySQL, Microsoft SQL Server, and Oracle supported
  • Other database flavors with JDBC drivers successfully tested
  • MATLAB side caching of JDBC objects
  • Retrieve data into MATLAB cells, structures, and tables

  • Supports plain SQL, prepared and callable statements
  • Supports transactions
  • Supports MS SQL Server Single Sign-On on Windows
  • Data-type mapping configurable (services available)
  • Underlying Java objects available for maximum control
  • Hooks for execution of MATLAB code on e.g. establishment of a connection
  • Create callable statement objects by procedure name
  • Generate template code for working statements

The Database Connector serves as a JDBC-based link for database operations within MATLAB. Acting as both an object-oriented MATLAB interface to JDBC drivers and an efficient means to transfer data from Java to MATLAB, it ensures high performance and controlled data transportation.

Interested?

Get in touch today, or book your quick-scan or free consult to get the conversation started.

Free consult Quick-scan Contact

© 2025 MonkeyProof Solutions B.V.

  • Terms & conditions
  • Privacy
  • License
We use cookies to personalise content and to analyse our web traffic.
OK
Manage your cookies
Essential site cookies
Google Analytics