Here you can find the source of getDriver(String dbms)
Parameter | Description |
---|---|
dbms | The name of a DBMS (MySQL, PostGreSQL, ...) |
public static String getDriver(String dbms)
//package com.java2s; /*//from w w w.j a v a2 s .c o m Weave (Web-based Analysis and Visualization Environment) Copyright (C) 2008-2011 University of Massachusetts Lowell This file is a part of Weave. Weave is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License, Version 3, as published by the Free Software Foundation. Weave 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 Weave. If not, see <http://www.gnu.org/licenses/>. */ public class Main { public static String MYSQL = "MySQL"; public static String POSTGRESQL = "PostgreSQL"; public static String SQLSERVER = "Microsoft SQL Server"; public static String ORACLE = "Oracle"; /** * @param dbms The name of a DBMS (MySQL, PostGreSQL, ...) * @return A driver name that can be used in the getConnection() function. */ public static String getDriver(String dbms) { if (dbms.equalsIgnoreCase(MYSQL)) return "com.mysql.jdbc.Driver"; if (dbms.equalsIgnoreCase(POSTGRESQL)) return "org.postgresql.Driver"; if (dbms.equalsIgnoreCase(SQLSERVER)) return "net.sourceforge.jtds.jdbc.Driver"; if (dbms.equalsIgnoreCase(ORACLE)) return "oracle.jdbc.OracleDriver"; return ""; } }