Retrieve database/Table name

Viewpoint
Enthusiast

Retrieve database/Table name

Hi all,

Can PDK provide the resolution of database/table name given its ID? I haven't figured out the right method to call yet.

The context of this question is when I want to output the database/table name that is causing a block on a particular session. The SessionDAO gives us the id details, but not the names.

Warmest regards,
2 REPLIES
Teradata Employee

Re: Retrieve database/Table name

The database and table names currently have to come from the Teradata system. Use the following method on com.teradata.monitor.dao.jdbc.TeradataMonitorDAOJDBC:

/**
* Identifies (the name of) a session, user, database, or table, given it's id
*
* @param hostId
* the host id.
* @param sessionNumber
* the session number.
* @param databaseId
* the database id,.
* @param userId
* the user id.
* @param tableId
* the table id.
* @return the name of the entity.
*/
String identify(int hostId, int sessionNumber, int databaseId, int userId, int tableId);

To get the database name, call identify(-1, -1, databaseId, -1, -1). To get the table name, call identify(-1, -1, -1, -1, tableId).
Enthusiast

Re: Retrieve database/Table name

Thanks a lot, Stever :)