Here you can find the source of getConnection(String connectionType)
public static Connection getConnection(String connectionType) throws SQLException, ClassNotFoundException
//package com.java2s; /*//from w ww. j ava2s . co m * Copyright (C) 2014 Picon software * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class Main { public static Connection getConnection(String connectionType) throws SQLException, ClassNotFoundException { switch (connectionType) { case "sqlite": return getSqliteConnection(); case "mysql": return getMySQLConnection(); case "jtds": default: return getJtdsConnection(); } } @SuppressWarnings("unused") private static Connection getSqliteConnection() throws SQLException, ClassNotFoundException { Class.forName("org.sqlite.JDBC"); return DriverManager.getConnection("jdbc:sqlite:E:/git-views/sqlite-latest.sqlite", "", ""); } @SuppressWarnings("unused") private static Connection getMySQLConnection() throws SQLException, ClassNotFoundException { Class.forName("com.mysql.jdbc.Driver"); return DriverManager.getConnection("jdbc:mysql://localhost:3306/eve_dump", "root", ""); } @SuppressWarnings("unused") private static Connection getJtdsConnection() throws SQLException, ClassNotFoundException { Class.forName("net.sourceforge.jtds.jdbc.Driver"); return DriverManager.getConnection("jdbc:jtds:sqlserver://localhost:1433/ebs_DATADUMP", "eve", "eve"); } }