正在为 java 应用程序建立 JDBC 连接

Establishing a JDBC connection for java application

我正尝试按照以下步骤为 Twitter driver 建立 JDBC 连接: enter image description here

我有:

有人可以向我解释如何将 driver JAR 添加到 class 路径以及如何建立连接(所以 JDBC URL 和driver class).

谢谢!

Right click on project -> Build Path -> Configure build path -> Add external jar

try {
     Class.forName("oracle.jdbc.driver.OracleDriver");
     Connection con = DriverManager.getConnection("jdbc:oracle:thin:@<hostname>:<port num>:<DB name>"
                ,"user","password");
     Statement stmt = con.createStatement();
     System.out.println("Created DB Connection....");
    } catch (ClassNotFoundException e) {
          e.printStackTrace();
    } catch (SQLException e) {
       e.printStackTrace();
    }