• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

jdbc connection !!

 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi!

I have just installed oracle 9i (Oracle9i Enterprise Edition Release 9.2.0.1.0 ) and set the classPath as follows

D:\oracle\ora92\jdbc\lib\ojdbc14.jar;D:\oracle\ora92\jdbc\lib\classes12.jar;

as i have installed it in D:\oracle

what is the problem ? The probem is this, i am not able to execute the following program !!

import java.sql.*;
class Demo
{
public static void main(String []args) throws SQLException,ClassNotFoundException
{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection ("jdbc:oracle:thin:@localhost:1521:orcl","scott","tiger");
System.out.println("Connection established successfully...");
}
}


I am getting the errors something like this !!

C:\Documents and Settings\sukhdevzcomputer\mypgms\jdbc>java Demo
Exception in thread "main" java.lang.UnsupportedClassVersionError: Demo (Unsuppo
rted major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)

The pgm is compiled but while i am trying to execute the program, i am getting these errors( above mentioned).

so can you help me !!
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exception in thread "main" java.lang.UnsupportedClassVersionError: Demo (Unsupported major.minor version 49.0)

This means that you are trying to execute a class which was compiled with Java 5 on an older version of Java (1.4 or older).

Make sure you are using the correct Java version. Check which Java version the Oracle JDBC libraries require.

Note: It is not necessary to include both ojdbc14.jar and classes12.jar. As far as I know, classes12.jar is an older version of the Oracle JDBC driver and ojdbc14.jar is a newer version. You need only one of the two.
 
sasank manohar
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have Java 1.5 version installed in my system. so I have

compiled the program and trying to run the program on same version ,

so there no chance of incompatibility as far as the version is concerned .I am not able to understand why I am getting those errors !!
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


so there no chance of incompatibility as far as the version is concerned


...well that is what is causing the problem. No doubt about it.

Oracle includes a JDK, and unless you are running Oracle 11g (which from your classpath it looks like you are not) you will have a 1.4.2 JDK on your system. Check your path - make sure you are using the javac you think you are to compile your class.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!