Database Toolbox | ![]() ![]() |
Performing Driver Functions
This part of the tutorial 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:
There is no equivalent M-file demo to run because the tutorial uses a PC and relies on a specific JDBC connection and database; your configuration will be different.
driver
function to construct a driver object for a specified database URL string of the form jdbc:<subprotocol>:<subname>
. For example, typed = driver('jdbc:oracle:thin:@144.212.33.228:1521:')
MATLAB returns the handle (identifier) for the driver object.
d = DriverHandle: [1x1 oracle.jdbc.driver.OracleDriver]
drivermanager
function. Typedm = drivermanager
LoginTimeout
value to 10
for all drivers loaded during this session, typeset(dm,'LoginTimeout',10)
v = get(dm)
v = Drivers: {'sun.jdbc.odbc.JdbcOdbcDriver@761630'} LoginTimeout: 10 LogStream: []
If you now connect to a database, the LoginTimeout
value will be 10
. For example, type
conn = database('SampleDB','','')
conn = Instance: 'SampleDB' UserName: '' Driver: [] URL: [] Constructor: [1x1 com.mathworks.toolbox.database.databaseConnect] Message: [] Handle: [1x1 sun.jdbc.odbc.JdbcOdbcConnection] TimeOut: 10 AutoCommit: 'on' Type: 'Database Object'
For a list of all the driver object functions you can perform, type
help driver/Contents
![]() | Accessing Metadata | Working with Cell Arrays in MATLAB | ![]() |