Results 1 to 8 of 8
  1. #1
    londonboy123 is offline Member
    Join Date
    Jul 2014
    Posts
    4
    Rep Power
    0

    Default package oracle.jdbc does not exist -

    Hi

    I added following classpath

    CLASSPATH

    C:\oracle\product\10.2.0\client_1\ojdbc14.jar

    While running the java program i am getting following error.

    package oracle.jdbc does not exist -


    Program code is below



    /*
    * To change this license header, choose License Headers in Project Properties.
    * To change this template file, choose Tools | Templates
    * and open the template in the editor.
    */

    package javaapplication2;

    import java.sql.*;
    import oracle.jdbc.*;
    import oracle.jdbc.pool.OracleDataSource;
    class JDBCVersion
    {
    public static void main (String args[]) throws SQLException
    {
    OracleDataSource ods = new OracleDataSource();
    ods.setURL("jdbc:oracle:thin:xx/xx@host:0000:xx");
    Connection conn = ods.getConnection();
    // Create Oracle DatabaseMetaData object
    DatabaseMetaData meta = conn.getMetaData();
    // gets driver info:
    System.out.println("JDBC driver version is " + meta.getDriverVersion());
    }

  2. #2
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    835
    Rep Power
    6

    Default Re: package oracle.jdbc does not exist -

    try to compile like this

    javac -classpath C:\oracle\product\10.2.0\client_1\ojdbc14.jar JDBCVersion.java
    Ramya:cool:

  3. #3
    londonboy123 is offline Member
    Join Date
    Jul 2014
    Posts
    4
    Rep Power
    0

    Default Re: package oracle.jdbc does not exist -

    I am new to java.
    i am using netbeans ide for development.
    is there anyway i can compile my program in netbeans ide

  4. #4
    exonaut is offline Member
    Join Date
    Mar 2013
    Location
    USA
    Posts
    25
    Rep Power
    0

    Default Re: package oracle.jdbc does not exist -

    If you're using netbeans just add the jar to your project and build then run.

  5. #5
    londonboy123 is offline Member
    Join Date
    Jul 2014
    Posts
    4
    Rep Power
    0

    Default Re: package oracle.jdbc does not exist -

    how do i add jar in netbeans?

    thanks in advance

  6. #6
    londonboy123 is offline Member
    Join Date
    Jul 2014
    Posts
    4
    Rep Power
    0

    Default Re: package oracle.jdbc does not exist -

    Ok.
    I figured it out.

    Now i am getting error

    Error: Could not find or load main class


    What should i do now?

  7. #7
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    835
    Rep Power
    6

    Default Re: package oracle.jdbc does not exist -

    1. Have you included your package name during compilation?
    2. whether your source file name and class name same?
    3. Have you checked your path?

    Refer this
    http://users.drew.edu/bburd/BeginProg2/NetBeans.pdf
    Ramya:cool:

  8. #8
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,023
    Rep Power
    6

    Default Re: package oracle.jdbc does not exist -

    Quote Originally Posted by londonboy123 View Post
    Error: Could not find or load main class


    What should i do now?
    How about: copy paste that error into google?

    "java Could not find or load main class"

    don't fall into the forum trap, just because you started a thread does not mean you can now sit back and get all the answers here. You have to take ownership of your problems again and investigate before you ask further questions.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. Replies: 1
    Last Post: 04-08-2013, 10:22 AM
  2. package jxl does not exist ??? any ideas
    By Macca07 in forum New To Java
    Replies: 5
    Last Post: 05-14-2012, 07:38 PM
  3. package does not exist
    By loja11 in forum New To Java
    Replies: 2
    Last Post: 09-25-2011, 04:26 PM
  4. package does not exist error
    By glaze24 in forum New To Java
    Replies: 1
    Last Post: 11-28-2010, 02:03 PM
  5. package mj does not exist
    By PzK in forum New To Java
    Replies: 8
    Last Post: 12-03-2008, 10:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •