code: public static Connection getConnection(String dataSourceName, boolean startTransaction)
              throws SQLException {
          Map<String, OpenConnStats> statsMap = openConnStats.get();
          OpenConnStats connStats = statsMap.get(dataSourceName);
          Connection conn;
  
          if (connStats == null) {
              // no existing connection, obtain a new one
              DataSource ds = getJdbcDataSource(dataSourceName);
              conn = ds != null ? ds.getConnection() : null;
              if (conn == null) {
                  return null;
              }
              openConnDsName.get().put(conn, dataSourceName);
  
              connStats = new OpenConnStats();
              connStats.conn = conn;
              // connStats.dsName = dataSourceName;
              statsMap.put(dataSourceName, connStats);
  
              if (!startTransaction) {
                  connStats.inTransaction = false;
                  conn.setAutoCommit(true);
              }
          } else {
              conn = connStats.conn;
          }
          connStats.counter.incrementAndGet();
  
          if (startTransaction) {
              startTransaction(conn);
          }
  
          return conn;
      }
docs: Obtains a JDBC connection from a named data-source (start a new
  transaction if specified).
  
  <p>
  Note: call {@link #returnConnection(Connection)} to return the connection
  back to the pool. Do NOT use {@code Connection.clode()}.
  </p>
  
  @param dataSourceName
  @param startTransaction
  @return
  @throws SQLException