ConnectToOracle
package com.WellsFargo.wim.Common;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
public class Connect_To_Oracle {
public static Statement connectToDB() {
Statement statement = null;
try {
Class.forName(“oracle.jdbc.driver.OracleDriver”);
// create connection object
Connection connection = DriverManager.getConnection(“jdbc:oracle:thin:@localhost:1521:orcl”, “HR”,
“password”);
// create a statement object
statement = connection.createStatement();
} catch (Exception e) {
System.out.println(“Exception thrown while connecting to DB”);
e.printStackTrace();
}
return statement;
}
}