User`s guide

Oracle JDBC for Windows
2-49
6
Add the Oracle OCI library full path to the Windows Path environment variable.
7
Open MATLAB.
For details about Java libraries, see “Bringing Java Classes into MATLAB Workspace”.
Step 3. Add the JDBC driver to the MATLAB static Java class path.
1
Run the prefdir command in the Command Window. The output is a file path to a
folder on your computer.
2
Close MATLAB if it is running.
3
Navigate to the folder and create a file called javaclasspath.txt in the folder.
4
Open javaclasspath.txt. Add the full path to the database driver JAR file in
javaclasspath.txt. The full path includes the path to the folder where you
downloaded the JAR file from the database provider and the JAR file name. For
example, C:\DB_Drivers\ojdbc6.jar. Save and close javaclasspath.txt.
5
Restart MATLAB.
Alternatively, you can use javaaddpath to add your JDBC driver to the dynamic Java
class path. For details about static and dynamic class paths, see “Bringing Java Classes
into MATLAB Workspace”.
Step 4. Set up the data source using Database Explorer.
This step is required only for connecting to Database Explorer. If you want to use the
command line to connect to your database, see “Connect to Oracle using the JDBC
connection command line.” on page 2-54
1
Open Database Explorer by clicking the Apps tab on the MATLAB Toolstrip. Then,
select Database Explorer from the Database Connectivity and Reporting
section in the apps gallery. Alternatively, enter dexplore at the command line. If
no data sources are set up, a message box opens. Click OK to close it. Otherwise, the
Connect to a Data Source dialog box opens. Click Cancel to close this dialog box.
2
Click the Database Explorer tab, and then select New > JDBC.