public Connection getConnection(String tenantIdentifier) throws SQLException {
   final Connection connection = connectionProvider.getConnection();
   String schema = null;
   if (Strings.isNullOrEmpty(tenantIdentifier)) {
     schema = Constants.TENANT_SCHEMA_DEFAULT;
   } else {
     schema = Constants.TENANT_SCHEMA_PREFIX + tenantIdentifier;
   }
   connection.createStatement().execute("USE " + schema);
   currentConnection.set(connection);
   return connection;
 }
 public void prepare(boolean needsAutoCommit) throws SQLException {
   connection = provider.getConnection();
   toggleAutoCommit = needsAutoCommit && !connection.getAutoCommit();
   if (toggleAutoCommit) {
     try {
       connection.commit();
     } catch (Throwable ignore) {
       // might happen with a managed connection
     }
     connection.setAutoCommit(true);
   }
 }
 public Connection getAnyConnection() throws SQLException {
   final Connection connection = connectionProvider.getConnection();
   return connection;
 }