Here you can find the source of getConnect(String driver, String url, String user, String password)
Parameter | Description |
---|---|
driver | a parameter |
url | a parameter |
user | a parameter |
password | a parameter |
Parameter | Description |
---|---|
SQLException | an exception |
ClassNotFoundException | an exception |
public static Connection getConnect(String driver, String url, String user, String password) throws SQLException, ClassNotFoundException
//package com.java2s; /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import java.sql.*; public class Main { /**//from w ww.j ava 2s . com * * @param driver * @param url * @param user * @param password * @return Connection * @throws SQLException * @throws ClassNotFoundException */ public static Connection getConnect(String driver, String url, String user, String password) throws SQLException, ClassNotFoundException { Class.forName(driver); return DriverManager.getConnection(url, user, password); } }