0

We've tried to execute the java DB snippet in Java8 installed machine, where I got an exception that ClassNotFoundException in sun.jdbc.odbc.JdbcOdbcDriver.

So we have understood that this is because of Removal of JDBC-ODBC bridge from Java8 and that's why the snippet we developed in Java7 is throwing this type of error.

Here, please confirm whether the same snippet will work if we downgrade the Java8 to Java7? If so, how can we do that downgradation? Is updating the environment variable PATH would be fair enough to instruct the machine to use Java7 for execution or we should do something else do?

Note: We don't have option for using some other drivers that support Java8. So please help us to overcome this situation. Thanks!

VedantK
  • 9,728
  • 7
  • 66
  • 71
zeal
  • 475
  • 4
  • 11
  • 25
  • 3
    Why use a class from `sun.*` to start with? – fge Jul 23 '15 at 07:36
  • 2
    No newer versions of Java will work for you. It is important that your boss understands that resources must be allocated for fixing your product! – Thorbjørn Ravn Andersen Jul 23 '15 at 07:39
  • What OS are you using? What IDE are you using? What CI are you using? – Puce Jul 23 '15 at 08:47
  • 2
    “We don't have option for using some other drivers that support Java8” Proof by claiming? It’s contradicted by the fact that you are developing against an `interface`. – Holger Jul 23 '15 at 10:52

1 Answers1

1

As explained in this StackOverflow answer, you will need to omit the Class.forName() statement for it to make it work.

Apart from PATH variable, for downgrading from Java 8 to Java 7, you would also need to set the JAVA_HOME variable. If you use Maven to power your builds, then this variable JAVA_HOME will be useful there as well.

Have a look at this article by Java.com giving information on the downgrade.

Information about reverting to Java 7 after installing Java 8

Community
  • 1
  • 1
Shishir Kumar
  • 7,981
  • 3
  • 29
  • 45