ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: SQL DESCRIBE command with iBatis
Date Fri, 08 Aug 2008 12:21:22 GMT
If you look in the DB2 information center under the DESCRIBE command, you
will see this:

<quote>
This statement can be embedded only in an application program. It is an
executable statement that cannot be dynamically prepared.
</quote>

This means that you cannot run DESCRIBE with iBATIS.

If you want to get column information, use one of the DB2 catalog views:

select * from syscat.columns where tabschema='FC017713' and
tabname='IUMOREP'

Jeff Butler




On Fri, Aug 8, 2008 at 3:55 AM, Gregor Cremosnik <GCR@ch.ibm.com> wrote:

>
> Hi,
>
> I have tried to execute an SQL DESCRIBE command to get the table definition
> with iBatis. But I get always an error.
>
> Command in the XML file:
>
> <resultMap id="DESCRIBE_RESULT" class="as4k.Describe">
>      <>result property="sqlLen" column="sqllen"/>
>      <result property="sqlType" column="sqltype"/>
>      <result property="sqlNameData" column="sqlname.data"/>
>      <result property="sqlNameLength" column="sqlname.length"/>
> </>resultMap>
>
> <statement id="describeTable" resultMap="DESCRIBE_RESULT">
>      DESCRIBE OUTPUT SELECT * FROM FC017713.IUMOREP
> </statement>
>
>
> StackTrace:
>
> Exception in thread "main" java.lang.RuntimeException: Something bad
> happened while building the
> sqlStatement.com.ibatis.common.jdbc.exception.NestedSQLException:
> --- The error occurred in as4k/IWABREP.xml.
> --- The error occurred while applying a parameter map.
> --- Check the describeTable-InlineParameterMap.
> --- Check the statement (query failed).
> --- Cause: com.ibm.db2.jcc.c.SqlException: DB2 SQL error: SQLCODE: -104,
> SQLSTATE: 42601, SQLERRMC: DESCRIBE OUTPUT;             ;<space>
>      at as4k.DynamicSql.findAllMigrationData(DynamicSql.java:42)
>      at as4k.DynamicSql.main(DynamicSql.java:27)
> Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:
> --- The error occurred in as4k/IWABREP.xml.
> --- The error occurred while applying a parameter map.
> --- Check the describeTable-InlineParameterMap.
> --- Check the statement (query failed).
> --- Cause: com.ibm.db2.jcc.c.SqlException: DB2 SQL error: SQLCODE: -104,
> SQLSTATE: 42601, SQLERRMC: DESCRIBE OUTPUT;             ;<space>
>      at
>
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback
> (
> GeneralStatement.java:185)
>      at
>
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList
> (
> GeneralStatement.java:123)
>      at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(
> SqlMapExecutorDelegate.java:615)
>      at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(
> SqlMapExecutorDelegate.java:589)
>      at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(
> SqlMapSessionImpl.java:118)
>      at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(
> SqlMapSessionImpl.java:122)
>      at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(
> SqlMapClientImpl.java:99)
>      at as4k.DynamicSql.findAllMigrationData(DynamicSql.java:39)
>      ... 1 more
> Caused by: com.ibm.db2.jcc.c.SqlException: DB2 SQL error: SQLCODE: -104,
> SQLSTATE: 42601, SQLERRMC: DESCRIBE OUTPUT;             ;<space>
>      at com.ibm.db2.jcc.c.fg.e(fg.java:1596)
>      at com.ibm.db2.jcc.c.fg.a(fg.java:1206)
>      at com.ibm.db2.jcc.b.gb.g(gb.java:140.)
>      at com.ibm.db2.jcc.b.gb.a(gb.java:39)
>      at com.ibm.db2.jcc.b.w.a(w.java:34).
>      at com.ibm.db2.jcc.b.vb.g(vb.java:139.)
>      at com.ibm.db2.jcc.c.fg.n(fg.java:1177)
>      at com.ibm.db2.jcc.c.gg.eb(gg.java:1862)
>      at com.ibm.db2.jcc.c.gg.d(gg.java:2295)
>      at com.ibm.db2.jcc.c.gg.X(gg.java:1332)
>      at com.ibm.db2.jcc.c.gg.execute(gg.java:1316)
>      at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(
> SqlExecutor.java:186)
>      at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery
> (GeneralStatement.java:205)
>      at
>
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback
> (
> GeneralStatement.java:173)
>      ... 8 more
>
> Does anybody have an idea what I do wrong??
>
> Tanks for your help
>
> Gregor
>
>
> IBM Global Business Services
>
> Internet-Mail: gcr@ch.ibm.com
> Postal Mail:   Vulkanstrasse 106 (VK), Postfach, 8010 Zurich
> Phone:            +41 58 333 69 21
> Fax:                  +41 58 333 40 40
> Natel:               +41 79 334 96 22
>
>

Mime
View raw message