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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With