Solved

class not found in type declaration?

Posted on 1998-10-07
1
327 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
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
topping3 challenge 14 80
egit plugin on eclipse 8 63
eclipse apache tomcat admin console 52 97
printf performancy 11 42
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …

777 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