Merge branch '1.5.x'

pull/7737/head
Stephane Nicoll 8 years ago
commit 7f9e534b67

@ -37,77 +37,83 @@ public enum DatabaseDriver {
/** /**
* Unknown type. * Unknown type.
*/ */
UNKNOWN("unknown", null, null), UNKNOWN(null, null),
/** /**
* Apache Derby. * Apache Derby.
*/ */
DERBY("derby", "Apache Derby", "org.apache.derby.jdbc.EmbeddedDriver", DERBY("Apache Derby", "org.apache.derby.jdbc.EmbeddedDriver",
"org.apache.derby.jdbc.EmbeddedXADataSource", "org.apache.derby.jdbc.EmbeddedXADataSource",
"SELECT 1 FROM SYSIBM.SYSDUMMY1"), "SELECT 1 FROM SYSIBM.SYSDUMMY1"),
/** /**
* H2. * H2.
*/ */
H2("h2", "H2", "org.h2.Driver", "org.h2.jdbcx.JdbcDataSource", "SELECT 1"), H2("H2", "org.h2.Driver", "org.h2.jdbcx.JdbcDataSource", "SELECT 1"),
/** /**
* HyperSQL DataBase. * HyperSQL DataBase.
*/ */
HSQLDB("hsqldb", "HSQL Database Engine", "org.hsqldb.jdbc.JDBCDriver", HSQLDB("HSQL Database Engine", "org.hsqldb.jdbc.JDBCDriver",
"org.hsqldb.jdbc.pool.JDBCXADataSource", "org.hsqldb.jdbc.pool.JDBCXADataSource",
"SELECT COUNT(*) FROM INFORMATION_SCHEMA.SYSTEM_USERS"), "SELECT COUNT(*) FROM INFORMATION_SCHEMA.SYSTEM_USERS"),
/** /**
* SQL Lite. * SQL Lite.
*/ */
SQLITE("sqlite", "SQLite", "org.sqlite.JDBC"), SQLITE("SQLite", "org.sqlite.JDBC"),
/** /**
* MySQL. * MySQL.
*/ */
MYSQL("mysql", "MySQL", "com.mysql.jdbc.Driver", MYSQL("MySQL", "com.mysql.jdbc.Driver",
"com.mysql.jdbc.jdbc2.optional.MysqlXADataSource", "SELECT 1"), "com.mysql.jdbc.jdbc2.optional.MysqlXADataSource", "SELECT 1"),
/** /**
* Maria DB. * Maria DB.
*/ */
MARIADB("mariadb", "MySQL", "org.mariadb.jdbc.Driver", MARIADB("MySQL", "org.mariadb.jdbc.Driver",
"org.mariadb.jdbc.MariaDbDataSource", "SELECT 1"), "org.mariadb.jdbc.MariaDbDataSource", "SELECT 1") {
@Override
public String getId() {
return "mysql";
}
},
/** /**
* Google App Engine. * Google App Engine.
*/ */
GAE("gae", null, "com.google.appengine.api.rdbms.AppEngineDriver"), GAE(null, "com.google.appengine.api.rdbms.AppEngineDriver"),
/** /**
* Oracle. * Oracle.
*/ */
ORACLE("oracle", "Oracle", "oracle.jdbc.OracleDriver", ORACLE("Oracle", "oracle.jdbc.OracleDriver",
"oracle.jdbc.xa.client.OracleXADataSource", "SELECT 'Hello' from DUAL"), "oracle.jdbc.xa.client.OracleXADataSource", "SELECT 'Hello' from DUAL"),
/** /**
* Postgres. * Postgres.
*/ */
POSTGRESQL("postgresql", "PostgreSQL", "org.postgresql.Driver", POSTGRESQL("PostgreSQL", "org.postgresql.Driver", "org.postgresql.xa.PGXADataSource",
"org.postgresql.xa.PGXADataSource", "SELECT 1"), "SELECT 1"),
/** /**
* jTDS. As it can be used for several databases, there isn't a single product name we * jTDS. As it can be used for several databases, there isn't a single product name we
* could rely on. * could rely on.
*/ */
JTDS("jtds", null, "net.sourceforge.jtds.jdbc.Driver"), JTDS(null, "net.sourceforge.jtds.jdbc.Driver"),
/** /**
* SQL Server. * SQL Server.
*/ */
SQLSERVER("sqlserver", "SQL SERVER", "com.microsoft.sqlserver.jdbc.SQLServerDriver", SQLSERVER("SQL SERVER", "com.microsoft.sqlserver.jdbc.SQLServerDriver",
"com.microsoft.sqlserver.jdbc.SQLServerXADataSource", "SELECT 1"), "com.microsoft.sqlserver.jdbc.SQLServerXADataSource", "SELECT 1"),
/** /**
* Firebird. * Firebird.
*/ */
FIREBIRD("firebird", "Firebird", "org.firebirdsql.jdbc.FBDriver", FIREBIRD("Firebird", "org.firebirdsql.jdbc.FBDriver",
"org.firebirdsql.pool.FBConnectionPoolDataSource", "org.firebirdsql.pool.FBConnectionPoolDataSource",
"SELECT 1 FROM RDB$DATABASE") { "SELECT 1 FROM RDB$DATABASE") {
@ -126,7 +132,7 @@ public enum DatabaseDriver {
/** /**
* DB2 Server. * DB2 Server.
*/ */
DB2("db2", "DB2", "com.ibm.db2.jcc.DB2Driver", "com.ibm.db2.jcc.DB2XADataSource", DB2("DB2", "com.ibm.db2.jcc.DB2Driver", "com.ibm.db2.jcc.DB2XADataSource",
"SELECT 1 FROM SYSIBM.SYSDUMMY1") { "SELECT 1 FROM SYSIBM.SYSDUMMY1") {
@Override @Override
@ -139,10 +145,15 @@ public enum DatabaseDriver {
/** /**
* DB2 AS400 Server. * DB2 AS400 Server.
*/ */
DB2_AS400("db2", "DB2 UDB for AS/400", "com.ibm.as400.access.AS400JDBCDriver", DB2_AS400("DB2 UDB for AS/400", "com.ibm.as400.access.AS400JDBCDriver",
"com.ibm.as400.access.AS400JDBCXADataSource", "com.ibm.as400.access.AS400JDBCXADataSource",
"SELECT 1 FROM SYSIBM.SYSDUMMY1") { "SELECT 1 FROM SYSIBM.SYSDUMMY1") {
@Override
public String getId() {
return "db2";
}
@Override @Override
protected Collection<String> getUrlPrefixes() { protected Collection<String> getUrlPrefixes() {
return Collections.singleton("as400"); return Collections.singleton("as400");
@ -158,12 +169,12 @@ public enum DatabaseDriver {
/** /**
* Teradata. * Teradata.
*/ */
TERADATA("teradata", "Teradata", "com.teradata.jdbc.TeraDriver"), TERADATA("Teradata", "com.teradata.jdbc.TeraDriver"),
/** /**
* Informix. * Informix.
*/ */
INFORMIX("informix", "Informix Dynamic Server", "com.informix.jdbc.IfxDriver", null, INFORMIX("Informix Dynamic Server", "com.informix.jdbc.IfxDriver", null,
"select count(*) from systables") { "select count(*) from systables") {
@Override @Override
@ -172,8 +183,6 @@ public enum DatabaseDriver {
} }
}; };
private final String id;
private final String productName; private final String productName;
private final String driverClassName; private final String driverClassName;
@ -182,18 +191,17 @@ public enum DatabaseDriver {
private final String validationQuery; private final String validationQuery;
DatabaseDriver(String id, String productName, String driverClassName) { DatabaseDriver(String productName, String driverClassName) {
this(id, productName, driverClassName, null); this(productName, driverClassName, null);
} }
DatabaseDriver(String id, String productName, String driverClassName, DatabaseDriver(String productName, String driverClassName,
String xaDataSourceClassName) { String xaDataSourceClassName) {
this(id, productName, driverClassName, xaDataSourceClassName, null); this(productName, driverClassName, xaDataSourceClassName, null);
} }
DatabaseDriver(String id, String productName, String driverClassName, DatabaseDriver(String productName, String driverClassName,
String xaDataSourceClassName, String validationQuery) { String xaDataSourceClassName, String validationQuery) {
this.id = id;
this.productName = productName; this.productName = productName;
this.driverClassName = driverClassName; this.driverClassName = driverClassName;
this.xaDataSourceClassName = xaDataSourceClassName; this.xaDataSourceClassName = xaDataSourceClassName;
@ -205,7 +213,7 @@ public enum DatabaseDriver {
* @return the identifier * @return the identifier
*/ */
public String getId() { public String getId() {
return this.id; return name().toLowerCase();
} }
protected boolean matchProductName(String productName) { protected boolean matchProductName(String productName) {

Loading…
Cancel
Save