See this description in the docs: https://docs.mendix.com/howto/integration/execute-an-sql-statement-on-an-external-database/
and if you have not done this already, install the database connector like this: https://docs.mendix.com/appstore/connectors/database-connector/
Download the database connector from Market Place , connect with connection string, then you can use the query/store proc to fetch the data from the database.