User`s guide
Using Driver Functions
6-37
Using Driver Functions
This example uses the following Database Toolbox functions to create driver and
drivermanager objects, and to get and set their properties:
• driver
• drivermanager
• get
• isdriver
• set
Note There is no equivalent MATLAB example available because this example relies on
a specific system-to-JDBC connection and database. Your configuration is different from
the one in this example, so you cannot run these examples exactly as written. Instead,
substitute appropriate values for your own system. See your database administrator for
details.
1
Connect to the database.
c = database('orc1','scott','tiger',...
'oracle.jdbc.driver.OracleDriver',...
'jdbc:oracle:thin:@144.212.123.24:1822:');
2
Use the driver function to construct a driver object and return its handle, for a
specified database URL string of the form jdbc:subprotocol:subname.
d = driver('jdbc:oracle:thin:@144.212.123.24:1822:')
DriverHandle: [1x1 oracle.jdbc.driver.OracleDriver]
3
Use the get function to get information, such as version data, for the driver object.
v = get(d)
v =
MajorVersion: 1
MinorVersion: 0
4
Use isdriver to verify that d is a valid JDBC driver object.
isdriver(d)
ans =
1