package ExamplePackage;
import java.sql.*; import java.util.*;
public class ConnectionManager {
static Connection con; static String url; public static Connection getConnection() { try { Class.forName("oracle.jdbc.driver.OracleDriver"); System.out.println(" Defing the URL"); String url= "jdbc:oracle:thin:@172.24.137.30:1521:ORA10G"; // assuming "DataSource" is your DataSource name // Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); try { System.out.println(" Defing the username"); String username= "e469573"; System.out.println(" Defing the password"); String password= "nkDquOhwj"; System.out.println(" Defing the connection"); con = DriverManager.getConnection(url,username,password); System.out.println(" connection done" +con); } catch (SQLException ex) { ex.printStackTrace(); } } catch(ClassNotFoundException e) { System.out.println(e); } return con;
} }
Ads