Which Oracle jdbc jars are required

喜你入骨 提交于 2019-12-23 05:59:17

问题


I am seeing many jars files in Oracle jdbc download page http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html

I have downloaded the following drivers:

  1. ojdbc6.jar
  2. ojdbc6_g.jar
  3. ojdbc6dms.jar
  4. ojdbc6dms_g.jar
  5. orai18n.jar

I am trying to use it in my Tomcat 7 version. I added all these jar files to $CATALINA_HOME/lib folder but after couple of days my Tomcat throws this error:

    HTTP Status 500 - Servlet execution threw an exception

type Exception report

message Servlet execution threw an exception

description The server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet execution threw an exception
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
root cause

java.lang.NoSuchMethodError: oracle.i18n.text.converter.CharacterConverterOGS.getInstance(I)Loracle/i18n/text/converter/CharacterConverter;
    oracle.sql.converter.CharacterConverterFactoryOGS.make(CharacterConverterFactoryOGS.java:40)
    oracle.sql.CharacterSetWithConverter.getInstance(CharacterSetWithConverter.java:135)
    oracle.sql.CharacterSetFactoryThin.make(CharacterSetFactoryThin.java:195)
    oracle.sql.CharacterSet.make(CharacterSet.java:555)
    oracle.jdbc.driver.DBConversion.init(DBConversion.java:236)
    oracle.jdbc.driver.DBConversion.<init>(DBConversion.java:133)
    oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1704)
    oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:385)
    oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:564)
    oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:251)
    oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:29)
    oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:563)
    java.sql.DriverManager.getConnection(DriverManager.java:571)
    java.sql.DriverManager.getConnection(DriverManager.java:215)
    DB.getOracleConnection(DB.java:13)
    IndexDAO.displayNewsTicker(IndexDAO.java:54)
    SiteTemplate.newsTicker(SiteTemplate.java:256)
    SiteTemplate.headerButtons(SiteTemplate.java:226)
    Index.doGet(Index.java:55)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.47 logs.

Apache Tomcat/7.0.47

my oracle version is SQL*Plus: Release 11.2.0.2.0 Production I searched a lot but mostly experts are talking about duplicate or wrong version of jdbc drivers. I doubled check both suggestion but same problem.

Now question came in my mind that I may adding in my tomcat lib folder wrong jars. I mean may be I need 1-2 jar files but adding 5 aforementioned jdbc jars that may have duplicate classes.

Please advise


回答1:


You just need this one: ojdbc6.jar.

  • ojdbc*.jar - all the classes to support basic functionality for the Thin and OCI drivers

  • ojdbc*_g.jar - same as ojdbc*.jar except compiled with the -g option to include debugging information and with java.util.logging calls included.

  • ojdbc*dms.jar - same as ojdbc*.jar except includes code to support Oracle Dynamic Monitoring Service (DMS). Also includes some JDBC logging support. This file can only be used when dms.jar is also in the classpath. The dms.jar file is not shipped as part of the RDBMS product. It is only available as part of the Oracle Application Server product.

  • ojdbc*dms_g.jar - same as ojdbc*dms.jar except compiled with the -g option to include debugging information and with full JDBC logging support.

  • orai18n.jar - contains the configuration information to support all Oracle character sets in Advanced Data Types (objects). If the database character set is one other than UCS2,ASCII, ISO_LATIN_1, UTF8 and AL32UTF8 and the application uses ADTs, then you must include this file in your classpath.

Taken from here: Oracle JDBC FAQ



来源:https://stackoverflow.com/questions/44218464/which-oracle-jdbc-jars-are-required

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!