Here you can find the source of getDatabaseType(DatabaseMetaData metaData)
public static String getDatabaseType(DatabaseMetaData metaData) throws SQLException
//package com.java2s; //License from project: Apache License import com.google.common.base.Strings; import java.sql.*; public class Main { public final static String DB_TYPE_ORACLE = "ORACLE"; public final static String DB_TYPE_MYSQL = "MYSQL"; public final static String DB_TYPE_OTHEER = "OTHER"; public static String getDatabaseType(Connection con) throws SQLException { return getDatabaseType(getDatabaseMetaData(con)); }/* www. j a va 2 s .c om*/ public static String getDatabaseType(DatabaseMetaData metaData) throws SQLException { if (metaData != null) { String name = metaData.getDatabaseProductName(); if (!Strings.isNullOrEmpty(name) && name.trim().toUpperCase().contains(DB_TYPE_MYSQL)) { return DB_TYPE_MYSQL; } else if (!Strings.isNullOrEmpty(name) && name.trim().toUpperCase().contains(DB_TYPE_ORACLE)) { return DB_TYPE_ORACLE; } } return DB_TYPE_OTHEER; } public static DatabaseMetaData getDatabaseMetaData(Connection con) throws SQLException { return con.getMetaData(); } }