Java JDBC Connection Create getConnection(final String url)

Here you can find the source of getConnection(final String url)

Description

get Connection

License

Open Source License

Declaration

public static Connection getConnection(final String url) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.sql.Connection;
import java.sql.DriverManager;

import java.sql.SQLException;

import java.util.Properties;

public class Main {
    public static Connection getConnection(final String url) {
        try {//from  w  ww . jav  a  2 s  .  c  o m
            return DriverManager.getConnection(url);
        } catch (SQLException e) {
            return null;
        }
    }

    public static Connection getConnection(final String url, final String user, final String password) {
        try {
            return DriverManager.getConnection(url, user, password);
        } catch (SQLException e) {
            return null;
        }
    }

    public static Connection getConnection(final String url, final Properties info) {
        try {
            return DriverManager.getConnection(url, info);
        } catch (SQLException e) {
            return null;
        }
    }
}

Related

  1. getConnection()
  2. getConnection()
  3. getConnection(@Nonnull String connectUrl)
  4. getConnection(final String driver, final String url)
  5. getConnection(final String driverName, final String driverUrl, final String userName, final String password)
  6. getConnection(final String url, final String username, final String password, final String driverClass)
  7. getConnection(Properties pro)
  8. getConnection(Properties prop)
  9. getConnection(Properties properties)