@Test public void testReadDatabaseAuthorities() throws SQLException { testee.readDatabaseAuthorities(testUser); }
Collection<DB2Authority> readDatabaseAuthorities(String user) throws SQLException { String accountIDUC = user.toUpperCase(); String sql = "SELECT * FROM SYSIBM.SYSDBAUTH WHERE GRANTEE = '" + accountIDUC + "' AND GRANTEETYPE = 'U'"; Collection<DB2Authority> grants = new ArrayList<DB2Authority>(); ResultSet rs = executeQuery(sql); while (rs.next()) { if (rs.getString("DBADMAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "DBADM", "", accountIDUC)); } if (rs.getString("CREATETABAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "CREATETAB", "", accountIDUC)); } if (rs.getString("BINDADDAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "BINDADD", "", accountIDUC)); } if (rs.getString("CONNECTAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "CONNECT", "", accountIDUC)); } if (rs.getString("NOFENCEAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "CREATE_NOT_FENCED", "", accountIDUC)); } if (rs.getString("IMPLSCHEMAAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "IMPLICIT_SCHEMA", "", accountIDUC)); } if (rs.getString("LOADAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "LOAD", "", accountIDUC)); } } return grants; }
DB2AuthorityReader { Collection<DB2Authority> readDatabaseAuthorities(String user) throws SQLException { String accountIDUC = user.toUpperCase(); String sql = "SELECT * FROM SYSIBM.SYSDBAUTH WHERE GRANTEE = '" + accountIDUC + "' AND GRANTEETYPE = 'U'"; Collection<DB2Authority> grants = new ArrayList<DB2Authority>(); ResultSet rs = executeQuery(sql); while (rs.next()) { if (rs.getString("DBADMAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "DBADM", "", accountIDUC)); } if (rs.getString("CREATETABAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "CREATETAB", "", accountIDUC)); } if (rs.getString("BINDADDAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "BINDADD", "", accountIDUC)); } if (rs.getString("CONNECTAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "CONNECT", "", accountIDUC)); } if (rs.getString("NOFENCEAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "CREATE_NOT_FENCED", "", accountIDUC)); } if (rs.getString("IMPLSCHEMAAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "IMPLICIT_SCHEMA", "", accountIDUC)); } if (rs.getString("LOADAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "LOAD", "", accountIDUC)); } } return grants; } }
DB2AuthorityReader { Collection<DB2Authority> readDatabaseAuthorities(String user) throws SQLException { String accountIDUC = user.toUpperCase(); String sql = "SELECT * FROM SYSIBM.SYSDBAUTH WHERE GRANTEE = '" + accountIDUC + "' AND GRANTEETYPE = 'U'"; Collection<DB2Authority> grants = new ArrayList<DB2Authority>(); ResultSet rs = executeQuery(sql); while (rs.next()) { if (rs.getString("DBADMAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "DBADM", "", accountIDUC)); } if (rs.getString("CREATETABAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "CREATETAB", "", accountIDUC)); } if (rs.getString("BINDADDAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "BINDADD", "", accountIDUC)); } if (rs.getString("CONNECTAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "CONNECT", "", accountIDUC)); } if (rs.getString("NOFENCEAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "CREATE_NOT_FENCED", "", accountIDUC)); } if (rs.getString("IMPLSCHEMAAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "IMPLICIT_SCHEMA", "", accountIDUC)); } if (rs.getString("LOADAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "LOAD", "", accountIDUC)); } } return grants; } DB2AuthorityReader(Connection adminConn); }
DB2AuthorityReader { Collection<DB2Authority> readDatabaseAuthorities(String user) throws SQLException { String accountIDUC = user.toUpperCase(); String sql = "SELECT * FROM SYSIBM.SYSDBAUTH WHERE GRANTEE = '" + accountIDUC + "' AND GRANTEETYPE = 'U'"; Collection<DB2Authority> grants = new ArrayList<DB2Authority>(); ResultSet rs = executeQuery(sql); while (rs.next()) { if (rs.getString("DBADMAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "DBADM", "", accountIDUC)); } if (rs.getString("CREATETABAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "CREATETAB", "", accountIDUC)); } if (rs.getString("BINDADDAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "BINDADD", "", accountIDUC)); } if (rs.getString("CONNECTAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "CONNECT", "", accountIDUC)); } if (rs.getString("NOFENCEAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "CREATE_NOT_FENCED", "", accountIDUC)); } if (rs.getString("IMPLSCHEMAAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "IMPLICIT_SCHEMA", "", accountIDUC)); } if (rs.getString("LOADAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "LOAD", "", accountIDUC)); } } return grants; } DB2AuthorityReader(Connection adminConn);  }
DB2AuthorityReader { Collection<DB2Authority> readDatabaseAuthorities(String user) throws SQLException { String accountIDUC = user.toUpperCase(); String sql = "SELECT * FROM SYSIBM.SYSDBAUTH WHERE GRANTEE = '" + accountIDUC + "' AND GRANTEETYPE = 'U'"; Collection<DB2Authority> grants = new ArrayList<DB2Authority>(); ResultSet rs = executeQuery(sql); while (rs.next()) { if (rs.getString("DBADMAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "DBADM", "", accountIDUC)); } if (rs.getString("CREATETABAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "CREATETAB", "", accountIDUC)); } if (rs.getString("BINDADDAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "BINDADD", "", accountIDUC)); } if (rs.getString("CONNECTAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "CONNECT", "", accountIDUC)); } if (rs.getString("NOFENCEAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "CREATE_NOT_FENCED", "", accountIDUC)); } if (rs.getString("IMPLSCHEMAAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "IMPLICIT_SCHEMA", "", accountIDUC)); } if (rs.getString("LOADAUTH").equals("Y")) { grants.add(new DB2Authority(AUTH_TYPE_DATABASE, "LOAD", "", accountIDUC)); } } return grants; } DB2AuthorityReader(Connection adminConn);   }