Search in sources :

Example 1 with ClassLoadingService

use of org.apache.cayenne.modeler.ClassLoadingService in project cayenne by apache.

the class DataSourceWizard method okAction.

/**
 * Tests that the entered information is valid and can be used to open a
 * conneciton. Does not store the open connection.
 */
public void okAction() {
    DBConnectionInfo info = getConnectionInfo();
    ClassLoadingService classLoader = getApplication().getClassLoadingService();
    // doing connection testing...
    try {
        this.adapter = info.makeAdapter(classLoader);
        this.dataSource = info.makeDataSource(classLoader);
        try (Connection connection = dataSource.getConnection()) {
        } catch (SQLException ignore) {
        }
    } catch (Throwable th) {
        reportError("Connection Error", th);
        return;
    }
    onClose(false);
}
Also used : ClassLoadingService(org.apache.cayenne.modeler.ClassLoadingService) SQLException(java.sql.SQLException) Connection(java.sql.Connection) DBConnectionInfo(org.apache.cayenne.modeler.pref.DBConnectionInfo)

Aggregations

Connection (java.sql.Connection)1 SQLException (java.sql.SQLException)1 ClassLoadingService (org.apache.cayenne.modeler.ClassLoadingService)1 DBConnectionInfo (org.apache.cayenne.modeler.pref.DBConnectionInfo)1