Here you can find the source of getConnection(String driver, String connectionString, String userName, String password)
static Connection getConnection(String driver, String connectionString, String userName, String password)
//package com.java2s; /**//from w w w . j a v a 2 s . c om * Sonar Data Migrator, A tool to migrate sonar project data between to separate sonar instances. * * Copyright (C) 2013 Worldline or third-party contributors as * indicated by the @author tags or express copyright attribution * statements applied by the authors. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/> */ import java.sql.Connection; import java.sql.DriverManager; public class Main { static Connection getConnection(String driver, String connectionString, String userName, String password) { Connection con = null; try { Class.forName(driver); con = DriverManager.getConnection(connectionString, userName, password); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return con; } }