oracle驱动异常:java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver

jdbc配置文件:

dbc.driverClassName=oracle.jdbc.driver.OracleDriver             (dbc.driverClassName=oracle.jdbc.driver.OracleDriver
jdbc.databaseURL=jdbc:oracle:thin:@127.0.0.1:1521:my_orcl
jdbc.username=xxx
jdbc.password=xxx

访问数据库时间出现异常:

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


原因:1、没有添加驱动包,即含oracle.jdbc.driver.OracleDriver 类的包

            2、包与类对应不正确

ojdbc5.jar或ojdbc6.jar (oracle 12c版本在D:\instantclient_11_2路径下)对应类dbc.driverClassName=oracle.jdbc.driver.OracleDriver 

但不含//\\ dbc.driverClassName=oracle.jdbc.driver.OracleDriver去掉driver的该类。

           3、确认类添加jar包正确的方法:选中oracle.jdbc.driver.OracleDriver ,然后ctrl+shift+t进行确认。




另:如oracle-jdbc-10.1.0.2.0包虽有oracle.jdbc.driver.OracleDriver 类,但数据库版本不一致,会出现如下异常;故要确保驱动与数据库版本的一致性。

2014-07-20 01:46:51  WARN BasicResourcePool:1841 - com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@e8553b -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception: 

java.sql.SQLException: ORA-28040: No matching authentication protocol


将jar文件拷贝到D:\dm\alpha\WebContent\WEB-INF\lib目录下,

并在.classpath中添加 ,若不添加,jar包可用,但无法通过ctrl+shifit+t查看某类属于哪个jar包。


(淡定,事出必有因,也不要被问题卡死,靠)

你可能感兴趣的:(oracle驱动异常:java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver)