Look at tool as ADBC - ABAP Database Connectivity to execute SQL statement (OO substitute of native SQL statements), but first you need to actually connect database.
This part is not related to Abap : For Information on a tool as DB connect, look at document DB Connect Architecture and reference note 323151 - Several DB connections with Native SQL. Not that Basis will be required to install some component to access a database type distinct from current one (An other manufacturer, e.g. access Oracle if SAP running on MS SQL)
NB: You could also perform some search on UD Connect (uses Application Server J2EE connectivity)
Regards,
Raymond