All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.xiaoyuge5201.config.DatabaseDriverEnum Maven / Gradle / Ivy

Go to download

数据库连接工具,查询mysql、oracle、sqlserver、postgresql的数据表以及字段信息;同时支持导出数据库设计文档

The newest version!
package com.github.xiaoyuge5201.config;

/**
 * 数驱动的常量
 *
 * @author yugb
 */
public enum DatabaseDriverEnum {

    /**
     * mysql数据库
     */
    MYSQL(1, "com.mysql.jdbc.Driver", "mysql数据库"),
    /**
     * Sql Server数据库
     */
    SQL_SERVER(2, "com.microsoft.sqlserver.jdbc.SQLServerDriver", "Sql Server数据库"),
    /**
     * oracle数据库
     */
    ORACLE(3, "oracle.jdbc.driver.OracleDriver", "oracle数据库"),
    /**
     * postgre sql数据库
     */
    POSTGRE_SQL(4, "org.postgresql.Driver", "postgre sql数据库"),
    /**
     * 达梦数据库
     */
    DM(5, "dm.jdbc.driver.DmDriver", "达梦数据库");
    /**
     * 数据库驱动类型
     */
    private final Integer type;
    /**
     * 数据库驱动连接
     */
    private final String driver;
    /**
     * 名称
     */
    private final String name;

    public Integer getType() {
        return type;
    }

    public String getDriver() {
        return driver;
    }

    public String getName() {
        return name;
    }

    DatabaseDriverEnum(Integer type, String driver, String name) {
        this.type = type;
        this.driver = driver;
        this.name = name;
    }

    /**
     * 根据数据库类型获取数据库驱动
     * @param type 数据库类型
     * @return 驱动
     */
    public static String getValue(Integer type) {
        DatabaseDriverEnum[] enums = values();
        for (DatabaseDriverEnum driverEnum : enums) {
            if (driverEnum.type.equals(type)) {
                return driverEnum.getDriver();
            }
        }
        return null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy