Search in sources :

Example 1 with ExasolServerSession

use of org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSession in project dbeaver by serge-rider.

the class ExasolUtils method readSessions.

public static Collection<ExasolServerSession> readSessions(DBRProgressMonitor progressMonitor, JDBCSession session) throws SQLException {
    LOG.debug("read sessions");
    List<ExasolServerSession> listSessions = new ArrayList<>();
    //check dba view
    try {
        try (JDBCStatement dbStat = session.createStatement()) {
            try (JDBCResultSet dbResult = dbStat.executeQuery(SESS_DBA_QUERY)) {
                while (dbResult.next()) {
                    listSessions.add(new ExasolServerSession(dbResult));
                }
            }
        }
    //now try all view
    } catch (SQLException e) {
        try (JDBCStatement dbStat = session.createStatement()) {
            try (JDBCResultSet dbResult = dbStat.executeQuery(SESS_ALL_QUERY)) {
                while (dbResult.next()) {
                    listSessions.add(new ExasolServerSession(dbResult));
                }
            }
        }
    }
    return listSessions;
}
Also used : JDBCStatement(org.jkiss.dbeaver.model.exec.jdbc.JDBCStatement) SQLException(java.sql.SQLException) JDBCResultSet(org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet) ArrayList(java.util.ArrayList) ExasolServerSession(org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSession)

Aggregations

SQLException (java.sql.SQLException)1 ArrayList (java.util.ArrayList)1 ExasolServerSession (org.jkiss.dbeaver.ext.exasol.model.app.ExasolServerSession)1 JDBCResultSet (org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet)1 JDBCStatement (org.jkiss.dbeaver.model.exec.jdbc.JDBCStatement)1