Jason Osgood
unread,Dec 8, 2010, 5:58:59 PM12/8/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to H2 Database
Hi Thomas Mueller, All.
I'm having trouble with the Connection.getMetaData().getTables(…)
method.
It works if the database is embedded (e.g. jdbc:h2:data/test/
metaData).
It does not work if the database is remote (e.g. jdbc:h2:tcp://
localhost/metaData).
It throws an exception (below) stating the TYPE_NAME column is
missing.
I did SELECT * FROM INFORMATION_SCHEMA.TABLES against both the
embedded and remote connections. The remote database is missing the
TYPE_NAME and TABLE_CLASS columns.
This bug probably wasn't caught because TestMetaData only works
against an embedded database.
That's as far as I got. I tried to figure out why remote and embedded
databases have different schemes. But my kung fu is weak.
Thanks for your help!
Cheers, Jason
---
Exception in thread "main" org.h2.jdbc.JdbcSQLException: Column
TYPE_NAME not found; SQL statement:
SELECT TABLE_CATALOG TABLE_CAT, TABLE_SCHEMA TABLE_SCHEM, TABLE_NAME,
TABLE_TYPE, REMARKS, TYPE_NAME TYPE_CAT, TYPE_NAME TYPE_SCHEM,
TYPE_NAME, TYPE_NAME SELF_REFERENCING_COL_NAME, TYPE_NAME
REF_GENERATION, SQL FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_CATALOG
LIKE ? ESCAPE '\' AND TABLE_SCHEMA LIKE ? ESCAPE '\' AND TABLE_NAME
LIKE ? ESCAPE '\' AND (TRUE) ORDER BY TABLE_TYPE, TABLE_SCHEMA,
TABLE_NAME [42122-112]
at org.h2.message.Message.getSQLException(Message.java:107)
at org.h2.message.Message.getSQLException(Message.java:118)
at org.h2.message.Message.getSQLException(Message.java:77)
at org.h2.expression.ExpressionColumn.optimize(ExpressionColumn.java:
130)
at org.h2.expression.Alias.optimize(Alias.java:49)
at org.h2.command.dml.Select.prepare(Select.java:725)
at org.h2.command.Parser.prepareCommand(Parser.java:233)
at org.h2.engine.Session.prepareLocal(Session.java:410)
at org.h2.server.TcpServerThread.process(TcpServerThread.java:221)
at org.h2.server.TcpServerThread.run(TcpServerThread.java:136)
at java.lang.Thread.run(Thread.java:680)
at org.h2.engine.SessionRemote.done(SessionRemote.java:543)
at org.h2.command.CommandRemote.prepare(CommandRemote.java:68)
at org.h2.command.CommandRemote.<init>(CommandRemote.java:47)
at org.h2.engine.SessionRemote.prepareCommand(SessionRemote.java:421)
at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:
1056)
at
org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:
71)
at
org.h2.jdbc.JdbcConnection.prepareAutoCloseStatement(JdbcConnection.java:
254)
at
org.h2.jdbc.JdbcDatabaseMetaData.getTables(JdbcDatabaseMetaData.java:
146)