Hi @chintanp, welcome to the forum!
The agent will only trace database queries if they're made within the context of a sampled transaction. Typically people use the agent with web applications, measuring the latency of requests, with details of operations such as database queries in those requests.
As yours is not a web application, you'll need to add some more instrumentation. Specifically, you'll need to start a transaction using apm.startTransaction before making the query, and end the transaction after the query has completed.