Java Database Driver Name Get getDriverName(String dbType)

Here you can find the source of getDriverName(String dbType)

Description

get Driver Name

License

Open Source License

Declaration

public static String getDriverName(String dbType) 

Method Source Code

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

public class Main {
    public static final String DBTYPE_MYSQL = "mysql";
    public static final String DBTYPE_ORACLE = "oracle";
    public static final String DBTYPE_POSTGRESQL = "postgresql";
    public static final String DBTYPE_SQLSERVER = "sqlserver";
    public static final String DBTYPE_DB2 = "db2";

    public static String getDriverName(String dbType) {

        String driverName = "";
        switch (dbType) {
        case DBTYPE_MYSQL:

            driverName = "com.mysql.jdbc.Driver";
            break;
        case DBTYPE_ORACLE:

            driverName = "oracle.jdbc.driver.OracleDriver";
            break;
        case DBTYPE_POSTGRESQL:

            driverName = "org.postgresql.Driver";
            break;

        case DBTYPE_SQLSERVER:

            driverName = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
            break;
        case DBTYPE_DB2:

            driverName = "com.ibm.db2.jdbc.app.DB2Driver";
            break;
        default:/* w  ww.ja  v  a2  s . com*/

            driverName = "unknow dbType";
            break;
        }

        return driverName;
    }
}

Related

  1. addDriver(String database, String jdoDriver, String driverClass, String urlPrefix, String sampleURL, String properties)
  2. driverClass(String url)
  3. getDriver(String dbms)
  4. getDriverClassName(String driver)
  5. getDriverClassNameByJdbcUrl(String url)
  6. getTypes()