Java JDBC Connection Create getUserConnection()

Here you can find the source of getUserConnection()

Description

get User Connection

License

Apache License

Declaration

public static Connection getUserConnection() throws SQLException 

Method Source Code

//package com.java2s;
//  Licensed under the Apache License, Version 2.0 (the "License");

import java.sql.SQLException;

import java.sql.Connection;
import java.sql.DriverManager;
import java.util.*;

import java.util.logging.*;

public class Main {
    static String url;
    static String usr;
    static String pwd;
    public static Properties props;

    public static Connection getUserConnection() throws SQLException {
        Connection connection = null;
        checkprops();//  w w  w  .ja v  a2s  . c o  m

        Logger.global.log(Level.FINE, "DriverManager.getConnection(url, usr, pwd)");
        connection = DriverManager.getConnection(url, usr, pwd);
        Logger.global.log(Level.INFO, "DriverManager.getConnection(url, usr, pwd) passed");
        Logger.global.log(Level.FINE, "==============\n\n");

        return connection;
    }

    static void checkprops() throws SQLException {
        if (props == null)
            throw new SQLException("Error: t4jdbc.properties is null. Exiting.");
    }
}

Related

  1. getStatement(Map config)
  2. getTargetConnection()
  3. getTestDBConnection()
  4. getTRECConnection()
  5. getUrlConnection()
  6. internalShutdown(String connectionString, int expectedErrorCode, String expectedSQLState)
  7. runSQLExecute(String sql, Map config)