Solved

class not found in type declaration?

Posted on 1998-10-07
1
344 Views
Last Modified: 2012-08-14
Hi,
 I am trying to use Orcle thin driver within JDK1.1.
The program is as simple as this:

import java.sql.*;
class JdbcApplication {
  public static void main (String args []) throws SQLException {
    // Load Oracle driver
    DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
     
    // Connect to the local database
    Connection conn =
      DriverManager.getConnection ("jdbc:oracle:thin:@199.81.96.83:1521:mkprod",
                                   "forecast_dba", "forecast");

    // Query the employee names
    Statement stmt = conn.createStatement ();
    ResultSet rset = stmt.executeQuery ("select country from outlook");

      // Print the name out
    while (rset.next ())
      System.out.println (rset.getString (1));
  }
}

But the compiler keeps saying "class oracle.jdbc.driver.OracleDriver() not found in
type declaration". I have set the right classpath.
Please help.
0
Comment
Question by:xz02
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
GregL earned 50 total points
ID: 1225465
Try this instead:

Class.forName( "oracle.jdbc.driver.OracleDriver" );
Connection conn =  DriverManager.getConnection("jdbc:oracle:thin:@199.81.96.83:1521:mkprod",
 "forecast_dba", "forecast");

0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question