Istao test for table existence did not work for me with Derby. The table was not found, even if it was created earlier. What is missing, you need to specify TABLE_SCHEM as "APP" and then set the table type to include "TABLE". Using null may work in previous versions, but using Derby 10.12 does not find a previously created table with the specified parameters equal to zero.
Connection conn = DriverManager.getConnection(DB_PROTO + DB_NAME + ";create=true"); DatabaseMetaData metas = conn.getMetaData(); ResultSet tables = metas.getTables(conn.getCatalog(), "APP", TABLE_NODES, new String[] {"TABLE"}); if (!tables.next()) { Statement stat = conn.createStatement(); stat.execute("create table " + ...
Hope this helps someone else.
garlicman
source share