You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-user@db.apache.org by Robert Einsle <ro...@einsle.de> on 2007/07/31 09:46:12 UTC

Error while Reading Model from Database

Hy List,

i've an Error, reading the Model from Database. We're using DB2 and the
stack-Trace is:

--- cut ---
Caused by: com.ibm.db2.jcc.c.SqlException: DB2 SQL error: SQLCODE: -204,
SQLSTATE: 42704, SQLERRMC: TFPEIN.AF01T02
    at com.ibm.db2.jcc.c.tf.e(tf.java:1680)
    at com.ibm.db2.jcc.c.tf.a(tf.java:1239)
    at com.ibm.db2.jcc.b.jb.h(jb.java:139)
    at com.ibm.db2.jcc.b.jb.a(jb.java:43)
    at com.ibm.db2.jcc.b.w.a(w.java:30)
    at com.ibm.db2.jcc.b.cc.f(cc.java:161)
    at com.ibm.db2.jcc.c.tf.n(tf.java:1219)
    at com.ibm.db2.jcc.c.tf.a(tf.java:1958)
    at com.ibm.db2.jcc.c.tf.a(tf.java:523)
    at com.ibm.db2.jcc.c.tf.executeQuery(tf.java:507)
    at
org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
    at
org.apache.ddlutils.platform.JdbcModelReader.determineAutoIncrementFromResultSetMetaData(JdbcModelReader.java:1064)
    at
org.apache.ddlutils.platform.db2.Db2ModelReader.readTable(Db2ModelReader.java:101)
    at
org.apache.ddlutils.platform.JdbcModelReader.readTables(JdbcModelReader.java:516)
    at
org.apache.ddlutils.platform.JdbcModelReader.getDatabase(JdbcModelReader.java:472)
    at
org.apache.ddlutils.platform.PlatformImplBase.readModelFromDatabase(PlatformImplBase.java:1920)
    ... 4 more
--- cut ---

DDL-Utils creates here an SQL-Statement:

--- cut ---
SELECT  <COLUMNS> FROM <TABLE> WHERE 1 = 0
--- cut ...

but i think, this is wrong, i muss the Database-Schema. The correct
Statement should be:

--- cut ---
SELECT  <COLUMNS> FROM <SCHMEA>.<TABLE> WHERE 1 = 0
--- cut ...

If i append the 2 Lines:

--- cut ---
        query.append(" FROM ");
        if (getPlatform().isDelimitedIdentifierModeOn())
        {
            query.append(getPlatformInfo().getDelimiterToken());
        }
        query.append(table.getSchema());
        query.append(".");
        query.append(table.getName());
        if (getPlatform().isDelimitedIdentifierModeOn())
        {
            query.append(getPlatformInfo().getDelimiterToken());
        }
        query.append(" WHERE 1 = 0");

--- cut ---


(table.getSchema() and . appended) then its working.

I think, this is a Bug.

Robert


Re: Error while Reading Model from Database

Posted by Robert Einsle <ro...@einsle.de>.
Hy Tom,

this is while Reading the Model from live Database. I don't know how to
set here the Schema other than this fix.

Robert

Thomas Dudziak schrieb:
> On 7/31/07, Robert Einsle <ro...@einsle.de> wrote:
>
>   
>> DDL-Utils creates here an SQL-Statement:
>>
>> --- cut ---
>> SELECT  <COLUMNS> FROM <TABLE> WHERE 1 = 0
>> --- cut ...
>>
>> but i think, this is wrong, i muss the Database-Schema. The correct
>> Statement should be:
>>
>> --- cut ---
>> SELECT  <COLUMNS> FROM <SCHMEA>.<TABLE> WHERE 1 = 0
>> --- cut ...
>>
>> I think, this is a Bug.
>>     
>
> DdlUtils does not fully support qualified table/sequence/... names
> (incl. the schema) yet. For now, you'll probably have to qualify them
> in the schema XML or, if all tables etc. are in the same schema which
> is corresponds to a user, access the db as this user.
>
> Tom
>
>   


Re: Error while Reading Model from Database

Posted by Thomas Dudziak <to...@gmail.com>.
On 7/31/07, Robert Einsle <ro...@einsle.de> wrote:

> DDL-Utils creates here an SQL-Statement:
>
> --- cut ---
> SELECT  <COLUMNS> FROM <TABLE> WHERE 1 = 0
> --- cut ...
>
> but i think, this is wrong, i muss the Database-Schema. The correct
> Statement should be:
>
> --- cut ---
> SELECT  <COLUMNS> FROM <SCHMEA>.<TABLE> WHERE 1 = 0
> --- cut ...
>
> I think, this is a Bug.

DdlUtils does not fully support qualified table/sequence/... names
(incl. the schema) yet. For now, you'll probably have to qualify them
in the schema XML or, if all tables etc. are in the same schema which
is corresponds to a user, access the db as this user.

Tom