GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — 解决依赖 APIJSON 4.7.2 + 时对接不上连接池 · slightlee/APIJSON-Demo@4d029c7

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • APIJSON-Java-Server/APIJSONDemo-HikariCP/src/main/java/apijson/demo
    • DemoSQLExecutor.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎APIJSON-Java-Server/APIJSONDemo-HikariCP/src/main/java/apijson/demo/DemoSQLExecutor.java‎

Copy file name to clipboardExpand all lines: APIJSON-Java-Server/APIJSONDemo-HikariCP/src/main/java/apijson/demo/DemoSQLExecutor.java
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,13 @@ public class DemoSQLExecutor extends APIJSONSQLExecutor {
4040
public Connection getConnection(SQLConfig config) throws Exception {
4141
// Log.d(TAG, "getConnection config.getDatasource() = " + config.getDatasource());
4242

43-
Connection c = connectionMap.get(config.getDatabase());
43+
String key = config.getDatasource() + "-" + config.getDatabase();
44+
Connection c = connectionMap.get(key);
4445
if (c == null || c.isClosed()) {
4546
try {
4647
DataSource ds = DemoApplication.getApplicationContext().getBean(DataSource.class);
4748
// 另一种方式是 DruidConfig 初始化获取到 Datasource 后给静态变量 DATA_SOURCE 赋值: ds = DruidConfig.DATA_SOURCE.getConnection();
48-
connectionMap.put(config.getDatabase(), ds == null ? null : ds.getConnection());
49+
connectionMap.put(key, ds == null ? null : ds.getConnection());
4950
} catch (Exception e) {
5051
Log.e(TAG, "getConnection try { "
5152
+ "DataSource ds = DemoApplication.getApplicationContext().getBean(DataSource.class); .."

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.