db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Boris Stumm <st...@informatik.uni-kl.de>
Subject Invoking methods directly in query
Date Thu, 07 Aug 2008 16:11:37 GMT
Hi,

I have an application that uses several INFORMATION_SCHEMA views.
This app I now want to use with derby, and found out that derby
has no INFORMATION_SCHEMA. I decided that writing the needed views
myself will be the easiest way, but stumbled over a problem that
I could not solve by googling etc.:


I need to get info from the type descriptor in SYS.SYSCOLUMNS,
and wanted it to do like in the following code snippet:

Connection c = DriverManager.getConnection("jdbc:derby:testdb");
c.createStatement()
  .executeQuery("select c.columndatatype.getTypeName()
                 from sys.syscolumns c");

That does not work, so I was looking in the derby source code,
and found
java/engine/org/apache/derby/impl/jdbc/metadata.properties
There, for example in the getColumns query string, it uses
basically the same method that I tried. How can I make this
work in my code?

I use derby 10.4.1.3 and Java 6.

Thanks for your help!

The exception thrown with above query is:

Exception in thread "main" java.sql.SQLSyntaxErrorException: 
Syntaxfehler: org.apache.derby.catalog.TypeDescriptor.getTypeName.
	at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
Source)
	at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
	at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
Source)
	at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
Source)
	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
Source)
	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
Source)
	at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedStatement.executeQuery(Unknown Source)
	at TestDerby.main(TestDerby.java:59)
Caused by: java.sql.SQLException: Syntaxfehler: 
org.apache.derby.catalog.TypeDescriptor.getTypeName.
	at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
Source)
	at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown 
Source)
	... 9 more
Caused by: ERROR 42X01: Syntaxfehler: 
org.apache.derby.catalog.TypeDescriptor.getTypeName.
	at org.apache.derby.iapi.error.StandardException.newException(Unknown 
Source)
	at 
org.apache.derby.impl.sql.compile.MethodCallNode.resolveMethodCall(Unknown 
Source)
	at 
org.apache.derby.impl.sql.compile.NonStaticMethodCallNode.bindExpression(Unknown 
Source)
	at 
org.apache.derby.impl.sql.compile.JavaToSQLValueNode.bindExpression(Unknown 
Source)
	at 
org.apache.derby.impl.sql.compile.ResultColumn.bindExpression(Unknown 
Source)
	at 
org.apache.derby.impl.sql.compile.ResultColumnList.bindExpressions(Unknown 
Source)
	at org.apache.derby.impl.sql.compile.SelectNode.bindExpressions(Unknown 
Source)
	at 
org.apache.derby.impl.sql.compile.DMLStatementNode.bindExpressions(Unknown 
Source)
	at org.apache.derby.impl.sql.compile.DMLStatementNode.bind(Unknown Source)
	at org.apache.derby.impl.sql.compile.CursorNode.bindStatement(Unknown 
Source)
	at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
	at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
	at 
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown

Source)
	... 3 more



-- 
Dipl.-Inf. Boris Stumm; Department of Computer Science, University of
Kaiserslautern; P.O. Box 3049, 67653 Kaiserslautern, Germany
Tel.: +49 631 205 3264, Fax: -3299
http://lgis.informatik.uni-kl.de/cms/index.php?id=41

Mime
View raw message