Solved

class not found in type declaration?

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
fibonacci ten numbers 4 45
Facing this issue for maven proxy setting 2 21
collection output issue 9 39
passing enum to a method 4 23
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

828 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