- This topic has 1 reply, 2 voices, and was last updated 18 years, 1 month ago by
Loyal Water.
-
AuthorPosts
-
TanujaMemberI 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….
TanuJune 1, 2007 at 11:54 am #270984
Loyal WaterMemberHi 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. -
AuthorPosts