-
Couldn't load subscription status.
- Fork 38.8k
Description
Etienne Studer opened SPR-8920 and commented
When using the jdbc:embedded-database element, Spring will use the same database name for each embedded database instance that it tries to create. As a consequence of using the same database name, all connections go against the same embedded H2 instance (and thus the data is shared) -> this causes troubles if multiple (and unrelated) application contexts are running at the same time or if more than one H2 instance with a separate datastore is needed in one application context.
See http://www.h2database.com/html/features.html#in_memory_databases for details.
Suggested fix: Provide a databaseName attribute on the jdbc:embedded-database element. This way, the developer can control the scope/visibility of the H2 instances.
Affects: 3.0.5
Issue Links:
- Introduce support for generating unique names for embedded databases [SPR-8849] #13491 Introduce support for generating unique names for embedded databases
- jdbc:datasource lacks 'name' attribute or related mechanism [SPR-7604] #12260 jdbc:datasource lacks 'name' attribute or related mechanism
- Introduce database-name attribute in <jdbc:embedded-database /> [SPR-12835] #17432 Introduce database-name attribute in <jdbc:embedded-database /> ("is superseded by")