#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    14
    Rep Power
    0

    Regarding Thin Clients


    I have a problem with Connecting to thin driver. I dont know how to connect to it.. I have a oracle server and i set the classpath to classes 12.zip file. and i m trying to execute the following code in client machine to connect to the oracle server using thin client. But i m getting the exception that is
    I m getting Exception in thread main No such Driver


    /*
    * This sample shows how to list all the names from the EMP table
    *
    * It uses the JDBC THIN driver. See the same program in the
    * oci8 samples directory to see how to use the other drivers.
    */

    // You need to import the java.sql package to use JDBC
    import java.sql.*;

    class Employee
    {
    public static void main (String args [])
    throws SQLException
    {
    // Load the Oracle JDBC driver
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());

    // Connect to the database
    // You must put a database name after the @ sign in the connection URL.
    // You can use either the fully specified SQL*net syntax or a short cut
    // syntax as <host>:<port>:<sid>. The example uses the short cut syntax.
    Connection conn =
    DriverManager.getConnection ("jdbcracle:thin:@dlsun511:1721:dbms733",
    "scott", "tiger");

    // Create a Statement
    Statement stmt = conn.createStatement ();

    // Select the ENAME column from the EMP table
    ResultSet rset = stmt.executeQuery ("select ENAME from EMP");

    // Iterate through the result and print the employee names
    while (rset.next ())
    System.out.println (rset.getString (1));
    }
    }

    What is the solution?
    Thankyou.
  2. #2
  3. No Profile Picture
    Senior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Canada
    Posts
    308
    Rep Power
    12
    You should try to write the exception controlled program to find the exact code that are causing to generate the error, like that:

    class Employee
    {
    public static void main (String args [])
    throws SQLException
    try{
    // Load the Oracle JDBC driver
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    }
    catch (Exception e){
    System.out.println("Driver not found.............");
    }

    Use the following code to load the driver:

    try{
    Class.forName("oracle.jdbc.driver.OracleDriver");
    }
    catch(ClassNotFoundException e) {
    System.err.println("Error loading driver: " + e);
    }

    Where you have saved the classes12.zip file in your directory?
    which webserver are you using?
    Did you have defined a proper classpath?

    Regards
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Posts
    14
    Rep Power
    0

    Thin client


    The following program that i sent u got executed properly later. But it happens only if set the classpath is set to classes111.zip file in client system.

    It means in my client PC, If i want to connect to oracle server database, I need to have classes111.zip file in my PC and i have to set the classpath to it.

    But this classes111.zip file will come along with oracle client installation.

    But i want a solution of connecting to the database, without having client version of oracle installed in my PC.
    Means, I want to connect to the server database with no class files like classes111.zip file in my system..

    So, if i m trying to execute the same program in a PC where no oracle client installed, Then i m getting an exception called OracleDriver Not found during compilation itself.

    How to connect to database now..
    What is the other way solution.
    Is it compulsory to have oracleDriver installed in all client PCs where we want to connect to server?

    What is this server-side thin driver?
    What is this client-side thin driver?
    What is this server-side Internal driver?

    Thankyou
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Oct 2003
    Location
    Germany
    Posts
    2,788
    Rep Power
    349
    Means, I want to connect to the server database with no class files like classes111.zip file in my system..
    That is not possible, where would you load the JDBC driver from?

    You need the oracle JDBC driver on the client's machine (just like you need your application on the client machine).
    You can distribute the .jar/.zip file together with your application (should be part of your application's installation)

    What JDK and Oracle Version are you using? classes111.zip is for JDK 1.1.x you shouldn't use that for your apps (The Oracle tools still use JDK 1.1 that's why it's include therer)

    Then there is a classes12.zip which is for JDK 1.2, and a ojdbc14.jar which should be used with JDK 1.4 and any newer Oracle version (it works with 8.1.x and 9.x even though the download link to ojdbc14.jar is only available through the 9.x links on Oracle's site) If you have a 9.x client installation ojdbc14.jar should already be on your machine.

    I suggest you use ojdbc14. jar and bundle it together with your application. Use an executable .jar file for your app, and include the JDBC driver in the classpath definition for your .jar's manifest file.
  8. #5
  9. SwollenMember
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    the master control
    Posts
    264
    Rep Power
    15
    you could connect without classes12.zip, however you would need something like OCI...which in short would mean you would have a bunch more crap on the client. if your goal is to have no extra oracle software on the client then i would suggest writing a server side app which requires the client only have a browser.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Oct 2003
    Location
    Germany
    Posts
    2,788
    Rep Power
    349
    you could connect without classes12.zip, however you would need something like OCI..
    That is not correct

    classes12.zip contains a level 4 JDBC driver, which means that it is implemented 100% Java and does not rely on any other software.

    When you use the thin driver (by putting the thin keyword in the JDBC url) you don't need anything besides your program and the classes12.zip (or ojdbc14.jar)
  12. #7
  13. SwollenMember
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    the master control
    Posts
    264
    Rep Power
    15
    read the post. he does not even want to use classes12...this is considered 'other oracle software' to him. btw who do you think wrote classes12.zip?

    http://otn.oracle.com/software/tech/...s/jdbc817.html

IMN logo majestic logo threadwatch logo seochat tools logo