Thanks for replying, comments inline!

On Friday, February 11, 2011 1:56:38 PM UTC-5, Thomas Mueller wrote:
>
> Hi,
>
> I don't know DbUnit, maybe you should ask there. Basically,
> _connection.getSchema() needs to return "PUBLIC" and not null. Maybe
> setting System.setProperty(PropertiesBasedJdbcDatabaseTester.DBUNIT_SCHEMA,
> "PUBLIC") will help - I found that here:
> http://www.dbunit.org/howto.html
>
I will try that, and I will examine the dbunit source to figure out why its 
null (I thought I had last time, but I must have missed something, I 
apologize).
 

> > String schemaName = _connection.getSchema();
> > Connection jdbcConnection = _connection.getConnection();
> > DatabaseMetaData databaseMetaData = jdbcConnection.getMetaData();
> > ResultSet resultSet = databaseMetaData.getColumns(null, schemaName,
> > tableName, "%");
> > Where schemaName is returning null.
>
> That's not good, because when using null, you will get all columns of
> all tables (in all schemas) with this table name.
>
Thats good to know :) Can we include something like that in the 
documentation, would be helpful for other implementations :)
 

> > But the databaseMetadata gives all the columns merged for 
> INFORMATION_SCHEMA.USERS and USERS.
>
> That's what DatabaseMetaData.getColumns is supposed to do (according
> to the JDBC API spec) if schemaName is null. It's not a bug (in H2).
>
Thanks for this info, I didn't know about the default behavior. If 
schemaName is null, it is not specified, in the past, not specifying the 
schema goes to the default database, maybe it would be nice if a default 
database could be set in H2 (I will check further to see how that is done).
 

> > Any idea what to do?
>
> I don't know how to make _connection.getSchema() return the correct
> schema name, I guess you need to find out why in DbUnit (I don't know
> DbUnit). Basically, schemaName should be "PUBLIC" and not null.
>
> > Are we not allowed creating tables that are named ROLES,
> > USERS, or anything inside INFORMATION_SCHEMA.* ?
>
> No. You can't create such a table: "create table
> information_schema.users(id int)" fails.
>

Sorry, I meant the other way around, since there is no default schema in H2, 
we have to place "PUBLIC" infront of tables that have the exact same name as 
the ones in INFORMATION_SCHEMA. So in this case, any tables inside 
INFORMATION_SCHEMA that we define in the public namespace should be prefixed 
with PUBLIC.* If not, then H2 will merge the columns together.
 
Would be nice if the default namespace in H2 is set to PUBLIC instead of 
setting it ourselves everytime. Thanks for the valuable information, I 
really appreciate it :)

I love this project, you have done a superb job!

> Regards,
> Thomas
>
>

-- 
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