This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
DatabaseLink Tutorial

Introduction to DatabaseLink


Data storage, indexing, and retrieval have long been crucial tasks of many large organizations such as governments, banks, hospitals, and libraries. As human societies have grown increasingly complex, data management requirements have also increased. Some of the new challenges include the complexity of what the data represents, how the data is used, as well as the sheer volume of data. Since the development of modern electronic computers in the latter half of the twentieth century, tools such as relational database management systems (RDBMS) and the Structured Query Language (SQL) have become standards that are widely used for data handling in many different types of organizations.
In a typical organization, many different users need to access the data management system, and hence many database applications are server based. They can be combined with other server-based technologies, often called enterprise technologies, such as web servers, web services, as well as remote computing heterogeneous architectures.
At the current time, there are many different database systems. These range from large-scale, expensive commercial applications that are suitable for high-end uses to freely available open-source tools running on personal computers with operating systems such as Microsoft Windows or Linux.
DatabaseLink is a Mathematica application that provides a set of tools allowing convenient integration of Mathematica with database management systems.

Mathematica Database Applications

There are a number of important benefits that can be gained from integrating Mathematica into a database system.
Mathematica contains a large collection of functions for numerical and symbolic computation that can be applied to data taken from a database. After the computations have been completed, the results can be stored in a database application, allowing Mathematica to work on the results at a later time. Mathematica might be used for statistical processing, modeling, or computing some optimal configuration. All of these computations typically require and produce data that can conveniently be stored in a database application.
Database applications can be integrated with many other application types, providing an important form of interoperability. Data derived from one application can be stored in the database. Then, elements of this data can be retrieved by Mathematica, used for computation, and the results stored in the database. Finally, another application can extract these results and use them for some further purpose. The central database application is the hub of this computational network; its interaction with Mathematica is made possible by DatabaseLink.

Features of DatabaseLink

  • Connectivity - works with most standard SQL database applications and with databases that are local and network based (including different types of computers).
  • The HSQL Database Engine (HSQLDB) - a lightweight database useful for database applications if you don't have an existing database.
  • Supplied drivers - built-in support for many important databases, including MySQL, Open Database Connectivity (ODBC), and HSQLDB.
  • SQL command interface - you can exploit your knowledge of SQL without learning a new system.
  • Mathematica command interface - useful if you are familiar with Mathematica programming.
  • GUI interfaces - the Database Explorer and the Connection Tool provide convenient tools for opening connections and querying the database.
  • Access to data and metadata - you can inspect the names of tables and columns, as well as the data in each entry.
  • Configurable - common tasks can be simplified and Mathematica applications can add their own database information.
  • Batch support - provides efficiency when making repeated changes to a database.
  • Data type support - works with standard SQL data types, including numbers, strings, binary data, date and time, as well as Mathematica expressions.
  • Support for advanced features - such as multiple connections and transactions (including rollbacks and savepoints).
  • Secure Socket Layer (SSL) support - security for communications with the database.

DatabaseLink Technology

DatabaseLink is based on the commonly used Java database connectivity (JDBC) technology, The package makes extensive use of the Mathematica Java toolkit J/Link, though no Java programming is required. The Database Explorer uses the Mathematica graphical user interface toolkit GUIKit,
DatabaseLink comes with a selection of drivers for a number of databases. If it does not include a driver for your database, you can install your own driver, as described in Database Connections: JDBC Connections.