Connect to Oracle10G using java in Linux

Source: Internet
Author: User
I thought that in Linux, ODBC data sources should be created in the same way as in windows. In fact, it is not necessary at all. You can directly connect to Oracle using the JAVA JDBC driver.

I thought that in Linux, ODBC data sources should be created in the same way as in windows. In fact, it is not necessary at all. You can directly connect to Oracle using the JAVA JDBC driver.

I thought that in Linux, ODBC data sources should be created in the same way as in windows. In fact, it is not necessary at all. You can directly connect to Oracle using the JAVA JDBC driver.

Use the following statement to load the JDBC driver of Oracle: Class. forName ("Oracle. driver. OracleDriver ");

Url = "jdbc: Oracle: thin: @ localhost: 1521: lg"; lg: Oracle_SID.

The key is to set the CLASSPATH variable: Oracle comes with a JDBC driver package. In the $ Oracle_HOME/jdbc/directory, there is a package named classes12.jar, so: export CLASSPATH = $ JAVA_HOME/lib: $ Oracle_HOME/jdbc/classes12.jar

The preceding settings allow you to successfully connect to the Oracle database.

The key is the driver problem. Remember to start the 1521 port listener ($ lsnrctl start ).

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.