Search in sources :

Example 6 with DBCredential

use of com.yahoo.dba.perf.myperf.common.DBCredential in project mysql_perf_analyzer by yahoo.

the class MetaDB method retrieveDBCredential.

/**
   * 
   * @param owner
   * @param dbGroupName
   * @return
   */
public DBCredential retrieveDBCredential(String owner, String dbGroupName) {
    Connection conn = null;
    try {
        if (!this.credCache.containsKey(owner + "||" + dbGroupName)) {
            conn = getConnection();
            DBCredential cred = retrieveDBCredential(conn, owner, dbGroupName);
            if (cred != null)
                this.credCache.put(owner + "||" + dbGroupName, cred);
        }
        DBCredential saved = this.credCache.get(owner + "||" + dbGroupName);
        if (//return a decrypted copy
        saved != null) {
            saved = saved.copy();
            saved.decryptPassword(keyTool);
        }
        return saved;
    } catch (Exception ex) {
        logger.log(Level.SEVERE, "Exception", ex);
    } finally {
        DBUtils.close(conn);
    }
    return null;
}
Also used : Connection(java.sql.Connection) DBCredential(com.yahoo.dba.perf.myperf.common.DBCredential) SQLException(java.sql.SQLException)

Aggregations

DBCredential (com.yahoo.dba.perf.myperf.common.DBCredential)6 ResultSet (java.sql.ResultSet)3 SQLException (java.sql.SQLException)3 ResultList (com.yahoo.dba.perf.myperf.common.ResultList)2 DBConnectionWrapper (com.yahoo.dba.perf.myperf.db.DBConnectionWrapper)2 Connection (java.sql.Connection)2 Statement (java.sql.Statement)2 Map (java.util.Map)2 AppUser (com.yahoo.dba.perf.myperf.common.AppUser)1 ColumnDescriptor (com.yahoo.dba.perf.myperf.common.ColumnDescriptor)1 ConfigBlock (com.yahoo.dba.perf.myperf.common.ConfigBlock)1 DBInstanceInfo (com.yahoo.dba.perf.myperf.common.DBInstanceInfo)1 QueryParameters (com.yahoo.dba.perf.myperf.common.QueryParameters)1 ResultRow (com.yahoo.dba.perf.myperf.common.ResultRow)1 UserDBConnections (com.yahoo.dba.perf.myperf.db.UserDBConnections)1 PreparedStatement (java.sql.PreparedStatement)1 Calendar (java.util.Calendar)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1