You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Dag H. Wanvik" <Da...@Sun.COM> on 2007/11/23 16:15:27 UTC

error? DatabaseMetaDataQuery on read-only database gives error

With released 10.3.1.4, I tried to connect to toursdb, which was
protected, so I had read-only access to it. Connecting with ij, a "show
tables" gave error:

> ERROR 40XD1: Container was opened in read-only mode.

Apparently because Derby attempt to store a SPS for the query.. Is to
be expected or is it an error? I thought Derby should handle this
by not storing any SPSes..

Using 10.3 trunk to access the same database, I even got an empty
pointer, see enclosed stack trace. This is surely a bug, When I made
the trunk version of toursdb read-only, I was back to 40XD1,
though. The latter may possibly be related to DERBY-1107?

Dag

---------------------------------------- 10.3 trunk ij run

khepri23:vm-mail$ java -Dij.exceptionTrace=true org.apache.derby.tools.ij
ij version 10.3
ij> connect 'jdbc:derby:/usr/local/share/java/javadb/JavaDB-10.3.1.4/demo/databases/toursdb';
ij> show tables;
ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
       at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
      at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:88)
   at org.apache.derby.impl.jdbc.Util.javaException(Util.java:245)
 at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
      at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
 at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:1573)
        at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
  at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(EmbedPreparedStatement.java:144)
    at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.<init>(EmbedPreparedStatement20.java:82)
 at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.<init>(EmbedPreparedStatement30.java:63)
 at org.apache.derby.impl.jdbc.EmbedPreparedStatement40.<init>(EmbedPreparedStatement40.java:40)
 at org.apache.derby.jdbc.Driver40.newEmbedPreparedStatement(Driver40.java:105)
  at org.apache.derby.impl.jdbc.EmbedConnection.prepareMetaDataStatement(EmbedConnection.java:1925)
       at org.apache.derby.impl.jdbc.EmbedDatabaseMetaData.prepareSPS(EmbedDatabaseMetaData.java:3665)
 at org.apache.derby.impl.jdbc.EmbedDatabaseMetaData.getPreparedQueryUsingSystemTables(EmbedDatabaseMetaData.java:3502)
  at org.apache.derby.impl.jdbc.EmbedDatabaseMetaData.getPreparedQuery(EmbedDatabaseMetaData.java:3550)
   at org.apache.derby.impl.jdbc.EmbedDatabaseMetaData.getPreparedQuery(EmbedDatabaseMetaData.java:3575)
   at org.apache.derby.impl.jdbc.EmbedDatabaseMetaData.getTables(EmbedDatabaseMetaData.java:1717)
  at org.apache.derby.impl.tools.ij.ij.showTables(ij.java:589)
    at org.apache.derby.impl.tools.ij.ij.ShowStatement(ij.java:1378)
        at org.apache.derby.impl.tools.ij.ij.ijStatement(ij.java:942)
   at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:342)
     at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:262)
        at org.apache.derby.impl.tools.ij.Main.go(Main.java:215)
        at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:181)
  at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
   at org.apache.derby.tools.ij.main(ij.java:71)
Caused by: java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
      at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
  at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:135)
      at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
      ... 26 more
Caused by: java.lang.NullPointerException
    at org.apache.derby.impl.sql.compile.ExecSPSNode.generate(ExecSPSNode.java:185)
 at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:447)
     at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:88)
 at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:753)
  at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(EmbedPreparedStatement.java:129)
    ... 19 more
ij>