Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Oracle thin client installation and use

Re: Oracle thin client installation and use

From: <vallikun_at_my-deja.com>
Date: Wed, 07 Jul 1999 15:49:52 GMT
Message-ID: <7lvsus$g4n$1@nnrp1.deja.com>


I followed what you have said below and it works fine for a java application. But when I try to run a servlet that requires a database connectivity I get java.lang.NoClassDefFoundError: oracle/jdbc/driver/OracleDriver

when I compile I give the classpath but I do not know how to specify it when I run because I am referring the filename from the web page.

Any suggestions would be greatly appreciated.

Thanks
Vallikun

In article <377A7A5C.61411FFF_at_rationalconcepts.com>,   "C." <c_ferguson_at_rationalconcepts.com> wrote:
> Hi,
> I'm not sure what the classes12.zip file is, but the Oracle thin
client that I
> downloaded came in classes111.zip. So, here's my advice using that.
> You download the classes111.zip file. Install it (put it without
unzipping) in
> say d:/orant/Jdbc directory (oops sorry, folder)(That directory
existed when I
> installed 8.0.4)
> If you are running as an application, then include
d:\orant\Jdbc\classes111.zip
> in your classpath.
>
> Your javac line should look like your java line. If you use the
classpath to
> compile the .java file, you should be using that same classpath to
run the
> executable.
>
> You instruct the javac tool to build the class file referencing
>

d:\JavaWebServer1.1.3\servlets;d:\jsdk2.0\lib\jsdk.jar;d:\JavaWebServer 1.1.3
> \classes,
> but you instructed the java tool to just use the classfiles in the
local
> directory containing JdbcCheckup.java and JdbcCheckup.class.
>
> Of course, I could be mistaken in this if you have set the CLASSPATH
environment
> variable. I do not do that on NTor my Unix box, because it can
confuse any
> other tool that would be using the CLASSPATH variable to find things.
>
> Instead, I use the -classpath option to specifically tell javac and
java tools
> where to look.
>
> Hope that helps, and I suggest you go download or use the Java
Tutorial at the
> javasoft web site.
> If you've downloaded the jdk from Sun, they have a demos directory
also...
>
> Regards,
> Cindy
>
> Lisa wrote:
>
> > I am trying to install and use Oracle's thin client on my NT
machine that
> > hosts the JavaWebServer1.1.3. I found the install instructions are
either
> > wrong or very vague. However, I was able to perform the install.
I
> > downloaded the classes12.zip file and unzipped it to create a
series of
> > directories, which I then moved to JavaWebserver1.1.3/classes. I
then
> > compiled the JdbcCheckup class (using javac -classpath
> >

d:\JavaWebServer1.1.3\servlets;d:\jsdk2.0\lib\jsdk.jar;d:\JavaWebServer 1.1.3
> > \classes JdbcCheckup.java ) successfully. However when I type:
java
> > JdbcCheckup, I get the following error:
> > Exception in thread "main" java.lang.NoClassDefFoundError:
d:\JavaWebServer:
> > oracle/jdbc/driver/OracleDriver at JdbcCheckup.main(Compiled Code)
> >
> > Note: The JdbcCheckup class is a class that Oracle provides that
performs a
> > simple query to check the database connection. The source code is:
> >
> > /*
> > * This sample can be used to check the JDBC installation.
> > * Just run it and provide the connect information. It will select
> > * "Hello World" from the database.
> > */
> >
> > // You need to import the java.sql package to use JDBC
> > import java.sql.*;
> >
> > // We import java.io to be able to read from the command line
> > import java.io.*;
> >
> > class JdbcCheckup
> > {
> > public static void main (String args [])
> > throws SQLException, IOException
> > {
> > // Load the Oracle JDBC driver
> > DriverManager.registerDriver(new
oracle.jdbc.driver.OracleDriver());
> >
> > // Prompt the user for connect information
> > System.out.println ("Please enter information to test
connection to the
> > database");
> > String user;
> > String password;
> > String database;
> >
> > user = readEntry ("user: ");
> > int slash_index = user.indexOf ('/');
> > if (slash_index != -1)
> > {
> > password = user.substring (slash_index + 1);
> > user = user.substring (0, slash_index);
> > }
> > else
> > password = readEntry ("password: ");
> > database = readEntry ("database (a TNSNAME entry): ");
> >
> > System.out.print ("Connecting to the database...");
> > System.out.flush ();
> >
> > System.out.println ("Connecting...");
> > Connection conn =
> > DriverManager.getConnection ("jdbc:oracle:thin:@" + database,
> > user, password);
> >
> > System.out.println ("connected.");
> >
> > // Create a statement
> > Statement stmt = conn.createStatement ();
> >
> > // Do the SQL "Hello World" thing
> > ResultSet rset = stmt.executeQuery ("select 'Hello World' from
dual");
> >
> > while (rset.next ())
> > System.out.println (rset.getString (1));
> >
> > System.out.println ("Your JDBC installation is correct.");
> >
> > // close the resultSet
> > rset.close();
> >
> > // Close the statement
> > stmt.close();
> >
> > // Close the connection
> > conn.close();
> > }
> >
> > // Utility function to read a line from standard input
> > static String readEntry (String prompt)
> > {
> > try
> > {
> > StringBuffer buffer = new StringBuffer ();
> > System.out.print (prompt);
> > System.out.flush ();
> > int c = System.in.read ();
> > while (c != '\n' && c != -1)
> > {
> > buffer.append ((char)c);
> > c = System.in.read ();
> > }
> > return buffer.toString ().trim ();
> > }
> > catch (IOException e)
> > {
> > return "";
> > }
> > }
> > }
> >
> > Any help would be greatly appreciated!!
> >
> > Note: I am using JDK1.2 (although I am not using any the features
specific
> > to 1.2 because the JavaWebServer doesn't support 1.2). Note also
that I
> > already have the Servlet application working with the ODBC-JDBC
bridge. I
> > am just trying to replace the use of that bridge with Oracle's Thin
JDBC
> > Client.
> >
> > Thanks
> > Lisa
>
>

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Wed Jul 07 1999 - 10:49:52 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US