Hello,

I was trying to figure out this very odd problem I am having. One of my 
coworkers changed the table name from User to Users without creating unit 
tests, then after a month when I created the unit tests, it started failing 
(we are using dbunit for testing).

org.dbunit.dataset.DataSetException: org.h2.jdbc.JdbcSQLException: Column 
"NAME" not found; SQL statement:
select NAME, ADMIN, REMARKS, ID, ID, VERSION, FIRST_NAME, IS_ACTIVE, 
LAST_NAME, LOGIN, PERMISSION_ID from USERS order by ID [42122-147]


As you seen above, it is prepending NAME, ADMIN, REMARKS, ID to my real 
table (all columns after that). I realized that this is from 
INFORMATION_SCHEMA. Are we not allowed creating tables that are named ROLES, 
USERS, or anything inside INFORMATION_SCHEMA.* ?

My datasource is set to this:

> <datasources>
>    <local-tx-datasource>
>       <jndi-name>appTestDatasource</jndi-name>
>       <connection-url>jdbc:h2:mem:mint;DB_CLOSE_DELAY=-1</connection-url>
>       <driver-class>org.h2.Driver</driver-class>
>       <user-name>sa</user-name>
>       <password></password>
>    </local-tx-datasource>
> </datasources>


I am using dbunit/H2 to help me test my Oracle database. Any help is 
appreciated! There was a thread in russian that had the same problem:
http://www.sql.ru/forum/actualthread.aspx?bid=38&tid=599722&hl=

I ran H2 database from the client, and it is correctly giving me the 
metadata. I initially thought it was *DBunit* who is doing this, but from 
the source of DBUnit, it is just doing this:

String schemaName = _connection.getSchema();
Connection jdbcConnection = _connection.getConnection();
DatabaseMetaData databaseMetaData = jdbcConnection.getMetaData();
ResultSet resultSet = databaseMetaData.getColumns(null, schemaName, 
tableName, "%");


Where schemaName is returning null.  But the databaseMetadata gives all the 
columns merged for INFORMATION_SCHEMA.USERS and USERS.

Any idea what to do?

Kind regards,
Mohamed

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to