| Database Toolbox™ | ![]() |
This example uses the following Database Toolbox functions to create driver and drivermanager objects, and to get and set their properties:
Note There is no equivalent M-file demo available for this example, 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 more information. |
c = database('orc1','scott','tiger',...
'oracle.jdbc.driver.OracleDriver',...
'jdbc:oracle:thin:@144.212.123.24:1822:');
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]
Use the get function to get information, such as version data, for the driver object.
v = get(d) v = MajorVersion: 1 MinorVersion: 0
Use isdriver to verify that d is a valid JDBC driver object.
isdriver(d) ans = 1
This result shows that d is a valid JDBC driver object. If it is a not valid JDBC driver object, the returned result is 0.
Use the drivermanager function to create a drivermanager object dm.
dm = drivermanager
Get properties of the drivermanager object.
v = get(dm)
v =
Drivers: {'sun.jdbc.odbc.JdbcOdbcDriver@761630' ...
[1x38 char]}
LoginTimeout: 0
LogStream: []
Set the LoginTimeout value to 10 for all drivers loaded during this session.
set(dm,'LoginTimeout',10)
Verify the LoginTimeout value.
v = get(dm)
v =
Drivers: {'sun.jdbc.odbc.JdbcOdbcDriver@761630'}
LoginTimeout: 10
LogStream: []
![]() | Working with Database Metadata | About Objects and Methods in the Database Toolbox Software | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |