This discussion is archived
3 Replies Latest reply: Dec 3, 2013 10:22 AM by dsurber RSS

How to avoid oracle.jdbc.driver.OracleConnection using

3c0845bd-ce77-4a4e-b3e5-ef5b815dc1db Newbie
Currently Being Moderated

i'am new in Java but recently i've got a project on support.

Problem:

solution worked on jvm 1.4, now on 1.7.

Respectively, class oracle.jdbc.driver.OracleConnection has been used.

Now I need class oracle.jdbc.OracleConnection to use CLOB.createTemporary() but...I can't.

According to the docs, it's enough to replace in code and config files one class declaration on another. But NO. I replaced all of them in all config files and anyway, there was only oracle.jdbc.driver.OracleConnection has been created. (there is no explicit declaration of connection type in code, everything is configured in config files)

 

Project uses marven, mybatis-3.1.1. Database: oracle 9

Driver: ojdbc14-9.2.0.5.jar contains both classes: both oracle.jdbc.driver.OracleConnection (for backward compatibility) and oracle.jdbc.OracleConnection.

The matter is what should i do to use second one instead of first one.

 

May be there is some java cache? I do not know...

Anybody knows?

  • 1. Re: How to avoid oracle.jdbc.driver.OracleConnection using
    rp0428 Guru
    Currently Being Moderated
    Now I need class oracle.jdbc.OracleConnection to use CLOB.createTemporary() but...I can't.

    Why not? You have to explain, in detail, WHAT you are trying and WHY you say you "can't" do it.

    According to the docs, it's enough to replace in code and config files one class declaration on another.

    That is correct - this IS all that is required. Replace ALL references to 'oracle.jdbc.driver' in your code.

    But NO. I replaced all of them in all config files and anyway, there was only oracle.jdbc.driver.OracleConnection has been created. (there is no explicit declaration of connection type in code, everything is configured in config files)

    We can't SEE what 'config' information you say you changed. It is what is in the CODE that matters, not what is in a config file.

     

    If the 'oracle.jdbc.driver' package is being imported by your code and a reference to 'Connection' is made Java will use it from the first package that it finds the class in.

     

    You are using an ANCIENT jdbc jar file. That doc you linked to WARNS you that you should upgrade and that doc is over ten years old.

     

    Remove that old jdbc jar file and use the current driver. Also remove references to the old package and replace them with references to the new package.

     

    With code and jars that are that old you can expect to have problems trying to use additional features, especially extensions. I would be surprised if you didn't have other issues as well.

     

    You need to perform code review to find all of the references that need to be corrected.

  • 2. Re: How to avoid oracle.jdbc.driver.OracleConnection using
    3c0845bd-ce77-4a4e-b3e5-ef5b815dc1db Newbie
    Currently Being Moderated

    I solved the issue!

     

    This thread helped me: https://forums.oracle.com/thread/556426 ("I have to use classes12.zip for it to work.")

     

    The main problem was jdbc driver - I tried all ones that I found on oracle download page and the only driver that made the job was classes12.jar (Oracle Database 10g Release 2 (10.2.0.1.0)). I replaced it in "ORACLE_HOME\jdbc\lib\" and in "apache-tomcat\lib\"

     

    Every driver has its own bugs and i did also different things so i can't say that just driver replacement is enough. F.e. I changed database timezone, run tzupdater, set vm param -Duser.timezone="-07:00", may be something else.

     

    Thanks a lot for so detailed answer!

  • 3. Re: How to avoid oracle.jdbc.driver.OracleConnection using
    dsurber Explorer
    Currently Being Moderated

    The other alternative is your code is using obsolete coding practices. classes12.jar is ancient and there is zero justification for using it. You should download the latest Oracle JDBC jar files and bring your code into the 21st century.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points