Java Connection Oracle's error resolution on Oracle.jdbc.driver.OracleDriver

Source: Internet
Author: User
Tags getmessage

Today, when you do a Java connection database, it appears:

Java.lang.ClassNotFoundException:oracle.jdbc.driver.OracleDriver

The error of this hint. Looking carefully, the JDBC driver is not loaded into project.

My code is as follows:

View Plaincopy to Clipboardprint?
try{
Class.forName ("Oracle.jdbc.driver.OracleDriver");
}
catch (Exception e) {
System.out.println (E.getmessage ());
System.exit (-1);
}
try{
Class.forName ("Oracle.jdbc.driver.OracleDriver");
}
catch (Exception e) {
System.out.println (E.getmessage ());
System.exit (-1);
}

This is the kind of error that I have solved:

1, find the database installation file JDBC file, assuming the path is D:/oracle/ora92/jdbc/lib

Add this path to the path of the environment variable.

Right-click My Computer-> advanced-> environment variable, in the system variable path to add the path above.

2, and then add the jar file in the D:/oracle/ora92/jdbc/lib directory to the project.

I'm using JBuilder, so I'll add six jar files under Lib to the library.

Tool->enterprise Setup->database drivers->add->new

In the New Library Wizard Name:jdbc Driver, add in the Library paths, put 6 files in the lib.

Click OK.

3, Project->project properties->paths->required Libraries->add, will just add in the JDBC driver plus

Click OK.

Run the program at this time, OK.

This article from Csdn Blog, reproduced please indicate the source: http://blog.csdn.net/bronica_chen/archive/2009/06/12/4264022.aspx

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.