MATLAB establishes a connection to the Oracle database through JDBC

Source: Internet
Author: User

 

The configuration process in Linux is the same as that in Windows:
1. Copy the jar package of oracle JDBC to the relevant directory of MATLAB (../Matlab/Java/JAR/toolbox.

The JDBC à lib (for example,/APP/Administrator/product/11.1.0/client_1/jdbc/LIB) in the Oracle 11g installation directory contains four files: ojdbc5.jar, ojdbc5_g.jar, ojdbc6.jar, and ojdbc6_g.jar.

Ojdbc5.jar and ojdbc5_g.jar are used in jdk1.5 and ojdbc6.jar and ojdbc6_g.jar are used in jdk1.6. Copy ojdbc6.jar to the Java/JAR/toolbox directory in the MATLAB main directory.

For example:
Oracle 11g is used on the Oracle server.
Copy the ojdbc6.jar package to the D:/Matlab/r2008b/Java/JAR/toolbox directory.

Note:
1. The client's ojdbc6.jar exists in the./product/11.1.0/client_1/jdbc/lib directory.
2. The ojdbc6.jar on the server exists in the./product/11.1.0/db_1/jdbc/lib directory.

2. Configure the classpath.txt file of MATLAB
Open the./Matlab/toolbox/localdirectory and edit the classpath.txt file. Add the following lines:
$ Maid/Java/JAR/toolbox/ojdbc6.jar
And save.

3. Establish a JDBC connection test to Oracle in MATLAB.
> Conn = database ('orcl ', 'Scott', '123 ',
'Oracle. JDBC. Driver. oracledriver ',
'Jdbc: oracle: thin: @ 192.168.0.101: 1521 :');
(Press enter)

Parameter description:
Orcl: Database Service name
SCOTT: User Name
123456: User Password
Oracle. JDBC. Driver. oracledriver: Driver
JDBC: oracle: thin: @ 192.168.0.101: 1521: connection string

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.