facebook

[Closed] Hi Need help

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #270973 Reply

    Tanuja
    Member

    I have stared newly working with myeclipse, i was testing the JDBC connection in a java bean its giving me error. But the same code i compiled independently its working

    Error is : Exception in thread “main” java.lang.Error: Unresolved compilation problem:
    oracle cannot be resolved to a type
    at TestPack.JdbcTest.main(JdbcTest.java:20)

    Please let me know wat are the need changes in configuration .. following is my code :

    package TestPack;

    import java.sql.*;
    import java.io.*;
    import java.sql.DriverManager;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.SQLException;

    public class JdbcTest
    {
    public static void main(String args[]) throws Exception
    {

    String query =”select * from users”;
    //Load and register Oracle driver
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());

    //Establish a connection
    Connection conn = DriverManager.getConnection(“jdbc:oracle:thin:@solo6.ims.att.com:1521:iris6t”, “master”, “master!3”);

    //Create a Statement object
    Statement sql_stmt = conn.createStatement();

    //Create a ResultSet object, execute the query and return a
    // resultset
    ResultSet rset = sql_stmt.executeQuery(query);
    while (rset.next())
    {

    System.out.println(rset.getString(1));
    }

    //Close the ResultSet and Statement
    rset.close();
    sql_stmt.close();
    //Close the database connection
    conn.close();
    }

    }

    Please help me as soon as possible..

    Thanks in advance….
    Tanu

    #270984

    Loyal Water
    Member

    Hi Tanu,
    You need add the oracle jars that your project needs by going to Project > Properties > Java Build Path > Libraries. That would resolve the problem.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: [Closed] Hi Need help

You must be logged in to post in the forum log in