Solved

class not found in type declaration?

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Java 1603 Error 3 45
endX challenge 2 50
nestparen challenge 4 57
Java Jpanels and Jframe 8 21
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
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…
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now