Java JDBC Driver getDriverClassName(String rawUrl)

Here you can find the source of getDriverClassName(String rawUrl)

Description

get Driver Class Name

License

Open Source License

Declaration

public static String getDriverClassName(String rawUrl) throws SQLException 

Method Source Code

//package com.java2s;

import java.sql.SQLException;

public class Main {
    private static final String ORACLE_DRIVER = "oracle.jdbc.driver.OracleDriver";
    private static final String MYSQL_DRIVER = "com.mysql.jdbc.Driver";

    public static String getDriverClassName(String rawUrl) throws SQLException {
        if (rawUrl.startsWith("jdbc:mysql:")) {
            return MYSQL_DRIVER;
        } else if (rawUrl.startsWith("jdbc:oracle:")) {
            return ORACLE_DRIVER;
        } else {/* www .j  av  a  2  s.  c o  m*/
            throw new SQLException("unkow jdbc driver : " + rawUrl);
        }
    }
}

Related

  1. createDriver(ClassLoader classLoader, String driverClassName)
  2. createDriver(String driverClassName)
  3. createDriver(String driverClassName)
  4. createDriver(String driverClassName)
  5. getDriverClassName(String rawUrl)
  6. getDriverFromPath(String path, String className)
  7. getRegisteredDrivers()
  8. getRSInfo(Object rsObj, int[] rsInfo, long[] rsCounter, Object[] conn, int[] errCode, String[] errDetail)