Package java.sql

Examples of java.sql.ResultSet.first()


                    throw new CloudRuntimeException("Cannot upgrade as there is no F5 load balancer device found in data center " + zoneId);
                }
                pstmt = conn.prepareStatement("SELECT id FROM external_load_balancer_devices WHERE  host_id=?");
                pstmt.setLong(1, f5HostId);
                rs = pstmt.executeQuery();
                if (rs.first()) {
                        f5DeviceId = rs.getLong(1);
                } else {
                    throw new CloudRuntimeException("Cannot upgrade as there is no F5 load balancer device with host ID " + f5HostId + " found in external_load_balancer_device");
                }
View Full Code Here


            // find the SRX device id  in the zone
                pstmt = conn.prepareStatement("SELECT id FROM host WHERE data_center_id=? AND type = 'ExternalFirewall' AND removed IS NULL");
                pstmt.setLong(1, zoneId);
                rs = pstmt.executeQuery();
                if (rs.first()) {
                        srxHostId = rs.getLong(1);
                } else {
                    throw new CloudRuntimeException("Cannot upgrade as there is no SRX firewall device found in data center " + zoneId);
                }
                pstmt = conn.prepareStatement("SELECT id FROM external_firewall_devices WHERE  host_id=?");
View Full Code Here

                    throw new CloudRuntimeException("Cannot upgrade as there is no SRX firewall device found in data center " + zoneId);
                }
                pstmt = conn.prepareStatement("SELECT id FROM external_firewall_devices WHERE  host_id=?");
                pstmt.setLong(1, srxHostId);
                rs = pstmt.executeQuery();
                if (rs.first()) {
                        srxDevivceId = rs.getLong(1);
                } else {
                    throw new CloudRuntimeException("Cannot upgrade as there is no SRX firewall device found with host ID " + srxHostId + " found in external_firewall_devices");
                }
View Full Code Here

        try {
            pstmt = txn.prepareAutoCloseStatement(GET_PROXY_LOAD);
            pstmt.setLong(1, proxyVmId);
           
            ResultSet rs = pstmt.executeQuery();
            if(rs != null && rs.first()) {
                return rs.getInt(1);
            }
        } catch (SQLException e) {
        } catch (Throwable e) {
        }
View Full Code Here

        try {
            pstmt = txn.prepareAutoCloseStatement(GET_PROXY_ACTIVE_LOAD);
            pstmt.setLong(1, proxyVmId);
           
            ResultSet rs = pstmt.executeQuery();
            if(rs != null && rs.first()) {
                return rs.getInt(1);
            }
        } catch (SQLException e) {
        } catch (Throwable e) {
        }
View Full Code Here

    createFindAUIDFromNameStatement(connection);
    findAUIDFromNameStatement.setString(1, name);
    findAUIDFromNameStatement.setString(2, name);
    findAUIDFromNameStatement.setString(3, name);
    ResultSet rs = findAUIDFromNameStatement.executeQuery();
    if (!rs.first()) {
      createFindAUIDFromAliasStatement(connection);
      findAUIDFromAliasStatement.setString(1, name);
      findAUIDFromAliasStatement.setString(2, name);
      rs = findAUIDFromAliasStatement.executeQuery();
      if (rs.first()) {
View Full Code Here

    if (!rs.first()) {
      createFindAUIDFromAliasStatement(connection);
      findAUIDFromAliasStatement.setString(1, name);
      findAUIDFromAliasStatement.setString(2, name);
      rs = findAUIDFromAliasStatement.executeQuery();
      if (rs.first()) {
        auid = rs.getString("o_auid");
        period = getPossiblyNullPeriod(rs);
        epoch = getPossiblyNullEpoch(rs);
        varType = getPossiblyNullStringValue(rs, "o_varType");
        spectralType = getPossiblyNullStringValue(rs, "o_specType");
View Full Code Here

    createFindStarNameFromAUIDStatement(connection);
    findStarNameFromAUID.setString(1, auid);

    ResultSet rs = findStarNameFromAUID.executeQuery();

    if (rs.first()) {
      starName = rs.getString("o_designation");
      period = getPossiblyNullPeriod(rs);
      epoch = getPossiblyNullEpoch(rs);
      varType = getPossiblyNullStringValue(rs, "o_varType");
      spectralType = getPossiblyNullStringValue(rs, "o_specType");
View Full Code Here

        try {
            jdbcConnection = getPooledConnectionProvider().getPooledConnection();
            statement = jdbcConnection.createStatement();
            resultSet = statement.executeQuery("select User from mysql.user where User='" + userName + "' and Host='"
                + host + "'");
            if (resultSet.first()) {
                return UP;
            }
        } catch (SQLException sqle) {
            // Will return DOWN
            System.out.println("sqle = " + sqle);
View Full Code Here

        ResultSet resultSet = null;
        try {
            jdbcConnection = getPooledConnectionProvider().getPooledConnection();
            statement = jdbcConnection.createStatement();
            resultSet = statement.executeQuery("show tables from " + databaseName + " like '" + tableName + "'");
            if (resultSet.first()) {
                return UP;
            }
        } catch (SQLException se) {
            // Will return down
        } finally {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.