Database Toolbox Previous page   Next Page

Setting Up a Data Source for JDBC Drivers

To set up a data source for use with a Windows or UNIX system using JDBC drivers, include a pointer to the JDBC driver location in the MATLAB file $matlabroot/toolbox/local/classpath.txt and restart MATLAB.

For example, if you have an Oracle database system that includes the JDBC drivers in the file, perform the following steps:

  1. Create a directory $matlabroot/dbtools.
  2. Put the file into dbtools.
  3. Add the file to the classpath.txt file, by including this line in classpath.txt
  1. $matlabroot/dbtools/

  1. Restart MATLAB.

The filename that contains the JDBC drivers is different for each database system. The file is available from your database provider. See the database reference page for examples of JDBC drivers and URLs.

For some databases, you first need to unzip the file containing the JDBC drivers, and then put the extracted file into dbtools and add it to classpath.txt. You can use the MATLAB unzip function to unzip the file.

For My SQL with JDBC drivers, add the JAR file reference to $MATLAB/toolbox/local/classpath.txt. This is an example:

The classpath.txt file includes a line that specifies the location of This is provided as an example only. If the file is not located where classpath.txt indicates, MATLAB will not be affected. If, or a similar file for your database system, is in a different location than classpath.txt indicates, update classpath.txt with the correct location and filename.

Setup for Using Visual Query Builder on UNIX Platforms

If you want to use the Visual Query Builder on UNIX platforms, perform these steps to set up the JDBC data source. (You cannot use the Visual Query Builder on a Windows platform with a JDBC driver.)

  1. Start MATLAB if it is not already running.
  2. Access the Configure Data Source dialog box by typing
  1. Any existing data sources are listed under Data source.

  1. Complete the Name, Driver, and URL fields. For some data sources, the Name must exactly match the name of the Data source. For example:
  1. Name: orcl

    Driver: oracle.jdbc.driver.OracleDriver

    URL: jdbc:oracle:thin:@

  1. Click Add to add the data source.
  2. Click Test to establish a test connection to the data source. You are prompted to supply a username and password if the database requires it.
  3. Click OK to save changes and close the Configure Data Source dialog box.

To remove a data source, select it from the Data source list in the Configure Data Source dialog box, click Remove, and click OK.

See the database reference page for examples of JDBC drivers and URLs.

Previous page  Setting Up a Data Source for ODBC Drivers Starting the Database Toolbox Next page

© 1994-2005 The MathWorks, Inc.