Does the Database Toolbox handle requests across different machines and operating systems?

2 views (last 30 days)
I would like to know, for example, if it is possible to access a database which is on UNIX or VMS when I am running MATLAB under Windows.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 2 Sep 2022
Edited: MathWorks Support Team on 2 Sep 2022
In general, you can access a database from another platform. By default, the Database Toolbox is set up to use the ODBC and JDBC drivers already on your machine, but you can certainly add additional drivers to communicate across platforms. The actual ability to access a remote database depends on whether your database server manufacturer has produced Windows ODBC or JDBC drivers for the database.
Here is an example that shows how to use the Database Toolbox under Windows with a remote Oracle server (either UNIX or VMS).
Oracle provides both ODBC and JDBC drivers for Oracle Server, so you can install these and then either setup an ODBC data source pointing to your Alpha or use the appropriate JDBC syntax. For your benefit, installation instructions and usage details are included for you.
*** Using ODBC (perhaps easier) ***
1. Obtain the appropriate ODBC driver from:
Choose "Oracle ODBC Drivers" and download the appropriate driver.
2. Install the ODBC driver according to the installation instructions provided with the ODBC driver. The driver should be a self-installing executable.
3. To use the remote database with the Database Toolbox, you must set up an ODBC data source. You should use the ODBC driver manager applet of the Windows Control Panel to locate the database. For best results, use a System DSN. Details on how to do this are included in Chapter 2 of the Database Toolbox User's Guide.
*** Setting up JDBC ***
1. Obtain a driver from the same URL listed in step 1 above. Choose "Oracle JDBC Drivers" and download the appropriate driver.
2. Install the driver according the installation instructions.
3. Edit the classpath.txt file in MATLAB\toolbox\local. Assuming that the driver was installed into the directory c:\orathin, add the line:
c:\orathin\classes111.zip
and save the file.
*** Using JDBC ***
JDBC protocol support enables users to access data both on their local network as well as databases on remote servers anywhere in the world provided they have internet access, IP address of the host machine for the target database, the port number through which the database server can be accessed, and a username/password for the database. Most database vendors supply drivers that support JDBC. For example, using ORACLE's JDBC driver, it is possible for a MATLAB session on a UNIX workstation to connect to an ORACLE NT database with the following DATABASE Toolbox command:
conn = database('orcl','my_user','secret_pass', ...
'oracle.jdbc.driver.OracleDriver', ...
'jdbc:oracle:thin:@154.212.137.22:1521:');
where "orcl" is the database SID; "my_user" and "secret_pass" are the username and password; "oracle.jdbc.driver.OracleDriver" is the JDBC driver from ORACLE; and
"jdbc:oracle:thin:@154.212.137.22:1521" is the URL that specifies the location of
the database server (154.212.137.22 is the target machine that the database server resides on, and 1521 is the port number).

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!