Can you create multiple catalogs in H2?

耗尽温柔 提交于 2019-12-10 20:26:45

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!