11502.patch
| new/src/com/goldencode/p2j/persist/orm/ConnectionProvider.java 2026-06-08 09:26:35 +0000 | ||
|---|---|---|
| 7 | 7 |
** -#- -I- --Date-- --------------------------------Description-------------------------------- |
| 8 | 8 |
** 001 AS 20260313 Created initial version. |
| 9 | 9 |
** 002 AS 20260319 Addef cfg, blob and clob creators initialization for h2 connections. |
| 10 |
** 003 TG 20260608 Route the dirty-share H2 database through the pooled JdbcDataSource so its |
|
| 11 |
** connections are recycled instead of opened and discarded on every dirty-share |
|
| 12 |
** operation. |
|
| 10 | 13 |
*/ |
| 11 | 14 | |
| 12 | 15 |
/* |
| ... | ... | |
| 109 | 112 |
boolean isH2 = jdbcUrl.startsWith("jdbc:h2:mem:");
|
| 110 | 113 |
try |
| 111 | 114 |
{
|
| 112 |
return isH2 && !database.isTemporary() ? getH2Connection(database, jdbcUrl, cfg) : |
|
| 115 |
// The dirty-share database is a single, long-lived in-memory H2 instance (one per primary |
|
| 116 |
// database) that is accessed concurrently by many session contexts. Route it through the |
|
| 117 |
// pooled JdbcDataSource so its connections are recycled across getDirtyInfo()/insert/update/... |
|
| 118 |
// calls instead of being created and discarded per call. Other non-temporary H2 databases |
|
| 119 |
// keep the direct DriverManager connection; temporary databases are handled by JdbcDataSource. |
|
| 120 |
boolean direct = isH2 && !database.isTemporary() && !database.isDirty(); |
|
| 121 |
return direct ? getH2Connection(database, jdbcUrl, cfg) : |
|
| 113 | 122 |
JdbcDataSource.getConnection(jdbcUrl, database, cfg, tenantName); |
| 114 | 123 |
} |
| 115 | 124 |
catch (SQLException e) |