Test code to query a database