I am trying to do a simple connection to an Oracle database and I have moved the ojdbc6.jar file into the same directory as the program file, but it still will not work. Any suggestions?
Here is the code (it dies on the line that says DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
with the error message package oracle.jdbc does not exist):
public static void main (String args )
// Load the Oracle JDBC driver
// Connect to the database
// You must put a database name after the @ sign in the connection URL.
// You can use either the fully specified SQL*net syntax or a short cut
// syntax as <host>:<port>:<sid>. The example uses the short cut syntax.
Connection conn =
// Create a Statement
Statement stmt = conn.createStatement ();
// Select the table names from the user_tables
ResultSet rset = stmt.executeQuery ("select TABLE_NAME from USER_TABLES");
// Iterate through the result and print out the table names
while (rset.next ())
System.out.println (rset.getString (1));
Log in to post a comment.