Java Utililty Methods JDBC Oracle Connection

List of utility methods to do JDBC Oracle Connection

Description

The list of methods to do JDBC Oracle Connection are organized into topic(s).

Method

ConnectioncreateConnection()
create Connection
String host = properties.getProperty("hostname");
String port = properties.getProperty("port");
String sid = properties.getProperty("sid");
String username = properties.getProperty("username");
String password = properties.getProperty("password");
String url = "jdbc:oracle:thin:@" + host + ":" + port + ":" + sid;
Class.forName("oracle.jdbc.driver.OracleDriver");
return DriverManager.getConnection(url, username, password);
...
ConnectioncreateDataBaseConnection(String hostName, String portNumber, String userName, String password)
create Data Base Connection
Class.forName("oracle.jdbc.OracleDriver");
return DriverManager.getConnection("jdbc:oracle:thin:@" + hostName + ":" + portNumber + ":" + hostName,
        userName, password);
voidCreateTableScript(String dbSourceName, String db2SchemaName, String schemaList, String server, int port, String dbName, String userid, String pwd)
Create Table Script
Connection mainConn = null;
String tableName = "";
String schemaName = "";
String OUTPUT_DIR = null;
String[] tableType = { "TABLE" };
String driverName = getDriverName(dbSourceName);
StringBuffer buffer = new StringBuffer();
Message = "";
...
ConnectiongetConnection()
get Connection
if (connection != null)
    return connection;
try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
} catch (ClassNotFoundException e) {
    e.printStackTrace();
    return null;
try {
    connection = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "dbms", "dbms");
} catch (SQLException e) {
    System.out.println("Connection Failed! Check output console");
    e.printStackTrace();
    return null;
if (connection != null) {
    System.out.println("You made it, take control your database now!");
} else {
    System.out.println("Failed to make connection!");
return connection;
ConnectiongetConnection()
get Connection
Connection con = null;
try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
} catch (ClassNotFoundException e) {
    e.printStackTrace();
try {
    con = DriverManager.getConnection("jdbc:oracle:thin:@hstslc015:1521:elp", "", "");
...
ConnectiongetConnection()
get Connection
try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    String url = "jdbc:oracle:thin:@bej301056.cn.oracle.com:1521:house02";
    String username = "transrepo";
    String password = "welcome1";
    Connection conn = DriverManager.getConnection(url, username, password);
    return conn;
} catch (Exception e) {
...
ConnectiongetConnection()
This method return a connection with database
Class.forName(DEFAULT_DRIVER);
Connection connection = DriverManager.getConnection(DEFAULT_URL, DEFAULT_USERNAME, DEFAULT_PASSWORD);
return connection;
ConnectiongetConnection()
get Connection
return DriverManager.getConnection(url, user, pass);
ConnectiongetConnection()
get Connection
return DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:xe", "scott", "tiger");
ConnectiongetConnection()
get Connection
if (connection != null) {
    return connection;
} else {
    String serverName = "IBCDS408";
    String portNumber = "1521";
    String sid = "DEV.BCDSS";
    String dbUrl = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
    try {
...