Oracle Thin JDBC Driver Problem - Run time - JDBC JAVA

This is a discussion on Oracle Thin JDBC Driver Problem - Run time - JDBC JAVA ; Hi, i did the following code: import java.sql.* ; import java.lang.*; class TestCommand { public static void main(String a[] ) throws SQLException { DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); Connection con = DriverManager.getConnection("jdbc racle:thin:@project:1521 roj","project1", "admission"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select ...

+ Reply to Thread
Results 1 to 9 of 9

Oracle Thin JDBC Driver Problem - Run time

  1. Default Oracle Thin JDBC Driver Problem - Run time

    Hi,
    i did the following code:

    import java.sql.* ;
    import java.lang.*;

    class TestCommand {

    public static void main(String a[] ) throws SQLException
    {
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection con =

    DriverManager.getConnection("jdbcracle:thin:@project:1521roj","project1",
    "admission");
    Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery("select * from admin");
    while( rs.next() )
    System.out.println( rs.getString("regno")) ;
    }
    }

    i Successfully compiled. but in runtime i found the following error.
    Exception in thread "main" java.lang.NoClassDefFoundError: TestCommand

    but same driver URL i safely connecting in netbeans 5.0..... Successfully
    running SQL commands & retrieving data.

  2. Default Re: Oracle Thin JDBC Driver Problem - Run time

    saro_77_vlr wrote:
    > Exception in thread "main" java.lang.NoClassDefFoundError: TestCommand


    This means that your own class TestCommand cannot be found through
    $CLASSPATH (%CLASSPATH%).

    Perhaps you forgot to add the current directory to %CLASSPATH%.

    You'll have to add the .jar file of the Oracle driver as well.

    Daniel


  3. Default Re: Oracle Thin JDBC Driver Problem - Run time

    Daniel Dittmar wrote:
    >> Exception in thread "main" java.lang.NoClassDefFoundError: TestCommand

    >
    >This means that your own class TestCommand cannot be found through
    >$CLASSPATH (%CLASSPATH%).
    >
    >Perhaps you forgot to add the current directory to %CLASSPATH%.
    >
    >You'll have to add the .jar file of the Oracle driver as well.
    >
    >Daniel


    Hi,
    I was working along with this person. The classes12.zip i.e. the JDBC driver
    file has been successfully appended to the CLASSPATH environment variable but
    of no use

    --
    Shouvik

    Message posted via JavaKB.com
    http://www.javakb.com/Uwe/Forums.asp...bases/200602/1

  4. Default Re: Oracle Thin JDBC Driver Problem - Run time

    Hello,
    > Perhaps you forgot to add the current directory to %CLASSPATH%.
    >
    > You'll have to add the .jar file of the Oracle driver as well.


    under NetBeans:

    - right mouse click on your project
    - select Properties
    - select Libraries and add your Oracle Driver

    Regards
    Michael

    --
    http://www.smurfi.de
    German NetBeans-Site

  5. Default Re: Oracle Thin JDBC Driver Problem - Run time

    Kroll, Michael wrote:
    >Hello,
    >> Perhaps you forgot to add the current directory to %CLASSPATH%.
    >>
    >> You'll have to add the .jar file of the Oracle driver as well.

    >
    >under NetBeans:
    >
    >- right mouse click on your project
    >- select Properties
    >- select Libraries and add your Oracle Driver
    >
    >Regards
    >Michael
    >


    Hi
    I did this too but to no result always the Exception raised is
    ClassNotFoundException pl help
    With regards

    --
    Shouvik

    Message posted via JavaKB.com
    http://www.javakb.com/Uwe/Forums.asp...bases/200602/1

  6. Default Re: Oracle Thin JDBC Driver Problem - Run time

    Shouvik Das via JavaKB.com wrote:
    > Daniel Dittmar wrote:
    >>> Exception in thread "main" java.lang.NoClassDefFoundError: TestCommand

    >> This means that your own class TestCommand cannot be found through
    >> $CLASSPATH (%CLASSPATH%).
    >>
    >> Perhaps you forgot to add the current directory to %CLASSPATH%.
    >>
    >> You'll have to add the .jar file of the Oracle driver as well.
    >>
    >> Daniel

    >
    > Hi,
    > I was working along with this person. The classes12.zip i.e. the JDBC driver
    > file has been successfully appended to the CLASSPATH environment variable but
    > of no use
    >


    Are you trying to run your code inside of NetBeans or from the command line?

    If it is the latter (c:\> java TestCommand), you have to add the
    directory containing TestCommand.class to CLASSPATH, (assuming that
    TestCommand.java contains no packagage statement).

    Java does *not* search the current directory for class files unless your
    CLASSPATH contains it.

    Daniel

  7. Default Re: Oracle Thin JDBC Driver Problem - Run time

    Hello,

    saro_77_vlr schrieb:
    > Hi,
    > i did the following code:
    >
    > import java.sql.* ;
    > import java.lang.*;
    >
    > class TestCommand {
    >
    > public static void main(String a[] ) throws SQLException
    > {
    > DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    > Connection con =
    >
    > DriverManager.getConnection("jdbcracle:thin:@project:1521roj","project1",
    > "admission");
    > Statement stmt = con.createStatement();
    > ResultSet rs = stmt.executeQuery("select * from admin");
    > while( rs.next() )
    > System.out.println( rs.getString("regno")) ;
    > }
    > }


    please try this (I don't have tested):

    public static void main(String a[] ) throws SQLException {
    Class.forName(oracle.jdbc.driver.OracleDriver);
    Connection con =
    DriverManager.getConnection(jdbcracle:thin:@project:1521roj","project1","admission");

    Statement stmt =
    con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
    ResultSet rs = stmt.executeQuery("select * from admin");
    System.out.println( rs.getString("regno")) ;
    }



    Regards
    Michael

    --
    http://www.smurfi.de
    German NetBeans-Site

  8. Default Re: Oracle Thin JDBC Driver Problem - Run time

    hi,
    it is not working.....

    plz help.............

    --
    Saravanan M

    Message posted via JavaKB.com
    http://www.javakb.com/Uwe/Forums.asp...bases/200602/1

  9. Default Re: Oracle Thin JDBC Driver Problem - Run time

    On Thu, 16 Feb 2006 11:25:28 +0000, Shouvik Das via JavaKB.com wrote:

    > Hi,
    > I was working along with this person. The classes12.zip i.e. the JDBC driver
    > file has been successfully appended to the CLASSPATH environment variable but
    > of no use


    Silly question, and no insult intended: do you alter the CLASSPATH for
    the environment? That is, inside the IDE?

    Or - as I have seen some do - with the environment up, set the CLASSPATH
    in the environment variables, without restarting the IDE.


+ Reply to Thread

Similar Threads

  1. Replies: 0
    Last Post: 10-09-2007, 03:21 PM
  2. Performance issue in multi-level Oracle Object/thin JDBC Options
    By Application Development in forum JDBC JAVA
    Replies: 0
    Last Post: 10-09-2007, 01:15 PM
  3. ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    By Application Development in forum JDBC JAVA
    Replies: 2
    Last Post: 04-14-2005, 07:49 PM
  4. Replies: 2
    Last Post: 04-04-2005, 10:34 AM
  5. Configuring Oracle 9i thin driver for WAS 5.1
    By Application Development in forum Java
    Replies: 1
    Last Post: 03-28-2005, 12:30 AM