All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sap.cloud.mt.runtime.ConnectionChecker Maven / Gradle / Ivy

There is a newer version: 3.3.3
Show newest version
/******************************************************************************
 * © 2020 SAP SE or an SAP affiliate company. All rights reserved.            *
 ******************************************************************************/
package com.sap.cloud.mt.runtime;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
@Deprecated
public class ConnectionChecker {
    public void checkConnection(String tenantId, DataSource dataSource, String dummySelectStatement) throws SQLException {
        try (TenantOverwrite overwrite = new TenantOverwrite(tenantId);
             Connection connection = dataSource.getConnection();
             Statement statement = connection.createStatement()) {
            if (dummySelectStatement != null && !dummySelectStatement.trim().isEmpty())
                statement.execute(dummySelectStatement);
            else statement.execute("select 1 as a from dummy");
        }
    }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy