Database Toolbox Previous page   Next Page

Performing Driver Functions

This example demonstrates how to create database driver and drivermanager objects so that you can get and set the object properties. You use these Database Toolbox functions:

  1. Connect to the database.
  2. Use the driver function to construct a driver object for a specified database URL string of the form jdbc:<subprotocol>:<subname>. For example, type
  1. MATLAB returns the handle (identifier) for the driver object.

  1. To get properties of the driver object, type
  1. MATLAB returns information about the driver's versions.

  1. To determine if d is a valid JDBC driver object, type
  1. MATLAB returns

    which means d is a valid JDBC driver object. Otherwise, MATLAB would have returned a 0.

  1. To set and get properties for all drivers, first create a drivermanager object using the drivermanager function. Type
  1. dm is the drivermanager object.

  1. Get properties of the drivermanager object. Type
  1. MATLAB returns

  1. To set the LoginTimeout value to 10 for all drivers loaded during this session, type
  1. Verify the value by typing

    MATLAB returns

    The next time you connect to a database, the LoginTimeout value will be 10. For example, type

    MATLAB returns

For a list of all the driver object functions, see Driver Object and Drivermanager Object.


Previous page  Accessing Metadata About Objects and Methods for the Database Toolbox Next page

© 1994-2005 The MathWorks, Inc.