问题
When you connect to an embedded local H2 database like so:
jdbc:h2:./target/data/CATALOGA;
H2 uses the database name (CATALOGA here) as the CATALOG_NAME. This can be seen by querying the INFORMATION_SCHEMA.CATALOGS table.
Is it possible to have more than one catalog?
You cannot insert into the INFORMATION_SCHEMA and H2 does not allow for CREATE CATALOG statements.
Background information is that we have queries that join across catalogs. So something that looks like:
select * from CATALOGA.dbo.example e
inner join CATALOGB.dbo.example2 e2 on e.fk = e2.fk
The queries have catalog/schema in them directly and I need to be able to execute them on H2.
回答1:
For H2, a catalog is a database. In H2, you can create multiple schemas within a database, but not multiple catalogs.
Of course you can create multiple databases, but I guess that's not what you want, because databases are independent. You can link a table in another databases using the "create linked table" feature, but the linked table is still in the same schema.
来源:https://stackoverflow.com/questions/25088998/can-you-create-multiple-catalogs-in-h2