Search in sources :

Example 1 with IConnection

use of org.eclipse.datatools.connectivity.IConnection in project jbosstools-hibernate by jbosstools.

the class ConsoleConfigurationUtils method isConnectionExist.

public static boolean isConnectionExist(ConsoleConfiguration consoleConfig) {
    String connProfileName = consoleConfig.getPreferences().getConnectionProfileName();
    IConnectionProfile profile = ProfileManager.getInstance().getProfileByName(connProfileName);
    IConnection conn = PingJob.createTestConnection(profile);
    if (conn.getConnectException() != null) {
        MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Establishing connection to database error", conn.getConnectException().getLocalizedMessage());
        return false;
    }
    return true;
}
Also used : IConnectionProfile(org.eclipse.datatools.connectivity.IConnectionProfile) IConnection(org.eclipse.datatools.connectivity.IConnection)

Aggregations

IConnection (org.eclipse.datatools.connectivity.IConnection)1 IConnectionProfile (org.eclipse.datatools.connectivity.IConnectionProfile)1