提交 8de80049 authored 作者: Thomas Mueller's avatar Thomas Mueller

H2 Console: improved IBM DB2 compatibility.

上级 d801bd5c
...@@ -21,6 +21,8 @@ Change Log ...@@ -21,6 +21,8 @@ Change Log
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul> <ul>
<li>H2 Console: improved IBM DB2 compatibility.
</li>
<li>A thread deadlock detector (disabled by default) can help <li>A thread deadlock detector (disabled by default) can help
detect and analyze Java level deadlocks. detect and analyze Java level deadlocks.
To enable, set the system property "h2.threadDeadlockDetector" to true. To enable, set the system property "h2.threadDeadlockDetector" to true.
......
...@@ -33,6 +33,7 @@ public class DbContents { ...@@ -33,6 +33,7 @@ public class DbContents {
private boolean isMySQL; private boolean isMySQL;
private boolean isFirebird; private boolean isFirebird;
private boolean isMSSQLServer; private boolean isMSSQLServer;
private boolean isDB2;
/** /**
* @return The default schema. * @return The default schema.
...@@ -104,6 +105,13 @@ public class DbContents { ...@@ -104,6 +105,13 @@ public class DbContents {
return isSQLite; return isSQLite;
} }
/**
* @return True if this is an IBM DB2 database.
*/
public boolean isDB2() {
return isDB2;
}
/** /**
* @return The list of schemas. * @return The list of schemas.
*/ */
...@@ -133,6 +141,7 @@ public class DbContents { ...@@ -133,6 +141,7 @@ public class DbContents {
rs.close(); rs.close();
prep.close(); prep.close();
} }
isDB2 = url.startsWith("jdbc:db2:");
isSQLite = url.startsWith("jdbc:sqlite:"); isSQLite = url.startsWith("jdbc:sqlite:");
isOracle = url.startsWith("jdbc:oracle:"); isOracle = url.startsWith("jdbc:oracle:");
// the Vertica engine is based on PostgreSQL // the Vertica engine is based on PostgreSQL
...@@ -158,7 +167,7 @@ public class DbContents { ...@@ -158,7 +167,7 @@ public class DbContents {
String[] tableTypes = { "TABLE", "SYSTEM TABLE", "VIEW", String[] tableTypes = { "TABLE", "SYSTEM TABLE", "VIEW",
"SYSTEM VIEW", "TABLE LINK", "SYNONYM", "EXTERNAL" }; "SYSTEM VIEW", "TABLE LINK", "SYNONYM", "EXTERNAL" };
schema.readTables(meta, tableTypes); schema.readTables(meta, tableTypes);
if (!isPostgreSQL) { if (!isPostgreSQL && !isDB2) {
schema.readProcedures(meta); schema.readProcedures(meta);
} }
} }
...@@ -202,6 +211,14 @@ public class DbContents { ...@@ -202,6 +211,14 @@ public class DbContents {
"db_backupoperator", "db_datareader", "db_datawriter", "db_backupoperator", "db_datareader", "db_datawriter",
"db_ddladmin", "db_denydatareader", "db_ddladmin", "db_denydatareader",
"db_denydatawriter", "db_owner", "db_securityadmin" }; "db_denydatawriter", "db_owner", "db_securityadmin" };
} else if (isDB2) {
ignoreNames = new String[] { "NULLID", "SYSFUN",
"SYSIBMINTERNAL", "SYSIBMTS", "SYSPROC", "SYSPUBLIC",
// not empty, but not sure what they contain
"SYSCAT", "SYSIBM", "SYSIBMADM",
"SYSSTAT", "SYSTOOLS",
};
} }
if (ignoreNames != null) { if (ignoreNames != null) {
for (String ignore : ignoreNames) { for (String ignore : ignoreNames) {
......
...@@ -1692,8 +1692,10 @@ public class WebApp { ...@@ -1692,8 +1692,10 @@ public class WebApp {
} }
boolean isUpdatable = false; boolean isUpdatable = false;
try { try {
if (!session.getContents().isDB2()) {
isUpdatable = rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE isUpdatable = rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE
&& rs.getType() != ResultSet.TYPE_FORWARD_ONLY; && rs.getType() != ResultSet.TYPE_FORWARD_ONLY;
}
} catch (NullPointerException e) { } catch (NullPointerException e) {
// ignore // ignore
// workaround for a JDBC-ODBC bridge problem // workaround for a JDBC-ODBC bridge problem
......
...@@ -80,7 +80,7 @@ public class WebServer implements Service { ...@@ -80,7 +80,7 @@ public class WebServer implements Service {
"jdbc:firebirdsql:localhost:c:/temp/firebird/test|sysdba", "jdbc:firebirdsql:localhost:c:/temp/firebird/test|sysdba",
"Generic SQLite|org.sqlite.JDBC|" + "Generic SQLite|org.sqlite.JDBC|" +
"jdbc:sqlite:test|sa", "jdbc:sqlite:test|sa",
"Generic DB2|COM.ibm.db2.jdbc.net.DB2Driver|" + "Generic DB2|com.ibm.db2.jcc.DB2Driver|" +
"jdbc:db2://localhost/test|" , "jdbc:db2://localhost/test|" ,
"Generic Oracle|oracle.jdbc.driver.OracleDriver|" + "Generic Oracle|oracle.jdbc.driver.OracleDriver|" +
"jdbc:oracle:thin:@localhost:1521:XE|sa" , "jdbc:oracle:thin:@localhost:1521:XE|sa" ,
......
...@@ -45,7 +45,7 @@ public class JdbcUtils { ...@@ -45,7 +45,7 @@ public class JdbcUtils {
"Cache:", "com.intersys.jdbc.CacheDriver", "Cache:", "com.intersys.jdbc.CacheDriver",
"daffodilDB://", "in.co.daffodil.db.rmi.RmiDaffodilDBDriver", "daffodilDB://", "in.co.daffodil.db.rmi.RmiDaffodilDBDriver",
"daffodil", "in.co.daffodil.db.jdbc.DaffodilDBDriver", "daffodil", "in.co.daffodil.db.jdbc.DaffodilDBDriver",
"db2:", "COM.ibm.db2.jdbc.net.DB2Driver", "db2:", "com.ibm.db2.jcc.DB2Driver",
"derby:net:", "org.apache.derby.jdbc.ClientDriver", "derby:net:", "org.apache.derby.jdbc.ClientDriver",
"derby://", "org.apache.derby.jdbc.ClientDriver", "derby://", "org.apache.derby.jdbc.ClientDriver",
"derby:", "org.apache.derby.jdbc.EmbeddedDriver", "derby:", "org.apache.derby.jdbc.EmbeddedDriver",
......
...@@ -775,3 +775,6 @@ unrecognized five omitting registering demo bson golomb bocher erwan ...@@ -775,3 +775,6 @@ unrecognized five omitting registering demo bson golomb bocher erwan
huff frequencies freq frequency divisors asymmetric ideal nth prob ans huff frequencies freq frequency divisors asymmetric ideal nth prob ans
bradmesserle dan incorporated keegan industries tagtraum cyr israels rafel bradmesserle dan incorporated keegan industries tagtraum cyr israels rafel
dance schedule hitting reverted youngest footers inliner deadlocked reorder nger dance schedule hitting reverted youngest footers inliner deadlocked reorder nger
nullid syspublic sysibmts sysibminternal syscat sysfun sysstat systools sysibmadm
sysproc jcc expecting
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论