xorpower
xorpower

Reputation: 18973

Check for DB2 locked users from SQL Server

I have a sql server database that uses linked server concept to connect to DB2 database. The DB2 database has read access only. I need to check every day whether the Db2 user is locked or not (due to incorrect password entered more than three times) from SQL Server. Once this is checked I can probably send an email to set of users about the status of the DB2 user (locked or unlocked)

How I can implement this feature? I am aware about SQL Server "loginproperty" concept that checks whether the user (using SQL Server Authentication) is locked out or not.

Thanks,

Upvotes: 0

Views: 2423

Answers (2)

Ian Bjorhovde
Ian Bjorhovde

Reputation: 11042

Query the remote table. If you get an error SQL30082N, the account is locked.

Upvotes: 1

mustaccio
mustaccio

Reputation: 18945

DB2 does not do user authentication -- the task is delegated to the operating system (or LDAP, if so configured). Therefore you will need to get the locked account information from that external authority (OS or LDAP), not DB2.

Upvotes: 1

Related Questions