Database query program: get list of connected devices