Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

oracle jdbc drivers - cannot resolve symbol

843859Oct 10 2005 — edited Oct 10 2005
while i'm not new to java, i am new to jdbc. need to connect a java app to an oracle database (hosted by a 3rd party). i have all the connection info. i've crafted a test program, but cannot get it to compile.

here's the code:
import java.sql.*;

public class SimpleJDBC
{
	public static void main(String[] args) throws SQLException, ClassNotFoundException
	{

	Class.forName(oracle.jdbc.driver.OracleDriver);
	System.out.println("Driver loaded");

	Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@database.host:1521:class"); //, "username", "password");
	System.out.println("Database connected");

	Statement statement = conn.createStatement();

	ResultSet results = statement.executeQuery("select first_name, last_name from user_tbl where last_name = 'Kendall'");

	while(results.next())
		System.out.println(results.getString(1) + "\t" + results.getString(2));

	conn.close();

	}
}
i've set the classpath to the location of the ojdbc14.jar, and it shows in the classpath when i do a "set" on the cmd line. i've tried it in netbeans, eclipse, and straight cmd line.

i always come up with the same message (cannot resolve symbol) on the line where i call Class.forName(oracle.jdbc.driver.OracleDriver);.

i've tried compiling and setting the classpath at the same time. i added the ojdbc14.jar to the compile/build paths in both the ides. i even tried using the old classes12.jar. nothing has worked.

i can't figure out what else there is. within the ides, the intellisense will actually let me put that line in (piece by piece), but then it shows an error.

any suggestions?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 7 2005
Added on Oct 10 2005
3 comments
1,194 views