The Artima Developer Community
Sponsored Link

Java Answers Forum
JAva Application and JDBC Oracle 10g connection problem

1 reply on 1 page. Most recent reply: Oct 23, 2005 10:43 PM by Kondwani Mkandawire

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
orod sem

Posts: 1
Nickname: orodsem
Registered: Oct, 2005

JAva Application and JDBC Oracle 10g connection problem Posted: Oct 23, 2005 4:14 AM
Reply to this message Reply
Advertisement
dear sir/madam,

it is my code:

public class MyMain {
public static void main(String[] args) throws SQLException, ClassNotFoundException{
String dbUrl = "jdbc:oracle:thin:@server.tafahom.org:1521:db";
String userName = "orod";
String password = "orod";
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection c =
DriverManager.getConnection(dbUrl,userName,password);
...

and it is my exception:
Exception in thread "main" java.lang.ClassNotFoundException:oracle.jdbc.driver.OracleDriver
...

please help me.
regards,
orodsem


Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: JAva Application and JDBC Oracle 10g connection problem Posted: Oct 23, 2005 10:43 PM
Reply to this message Reply
>
> DriverManager.getConnection(dbUrl,userName,password);
> ...
>
> and it is my exception:
> Exception in thread "main"
> java.lang.ClassNotFoundException:oracle.jdbc.driver.OracleD
> river
> ...

Means exactly that. The JVM was unable to locate the class
OracleDriver. What you want to do is ensure that you have
the appropriate Jar File containing this Driver. There should
be a Jar File with a Name to the effect of SomeName-oracle-SomeOtherString.jar

Its obviously not called SomeName-etc... but it most likely
has "oracle" within the String name terminated with a Jar.

Do the following:

jar -tvf SomeName-oracle-SomeOtherString.jar

And is should list if the OracleDriver is contained.

Then if you are using a *nix system. set the classpath
as follows:

export CLASSPATH=$CLASSPATH:./:/locationOfOracleJarDirectory/SomeName-oracle-SomeOther String.jar

In Windows:

set CLASSPATH=%CLASSPATH%;C:\locationOfOracleJarDirectory/SomeName-oracle-SomeOther String.jar

with your class path set you can now run your program.

Good luck,
Kondwani

Flat View: This topic has 1 reply on 1 page
Topic: Eclipse won't  build/run because it's "missing VM" Previous Topic   Next Topic Topic: Help with a basic JAVA program for class-

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use