This Java code compiles fine, but when I try to run it I get:
Exception in thread "main" java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
Here is my code:
import java.sql.*;
public class TestConnection {
public static void main(String[] args) throws Exception {
//connect to database
Class.forName("oracle.jdbc.driver.OracleDriver");
String serverName = "000.000.000.000";
String portNumber = "1521";
String sid = "abcd";
String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
String username = "user";
String password = "pass";
Connection conn = DriverManager.getConnection(url, username, password);
}
}
How do I get this to work? I am using Ubuntu 11.04 and JDK 6.
Thanks!