With ODBC, the URL information is established in the OS. For MariaDB see this post → Creating a Data Source with MariaDB Connector/ODBC
Once you have established this, the code for this can be found in the document by Andrew Pitonyak called
Andrew Base found here → Database access using OpenOffice.org
Section ‘8.5. Connections’ (page 98) deals with some of the specifics and ‘8.6.6. Paradox using ODBC’ (page 113) deals with an actual connection. Now although it is for paradox, for MariaDB it is no different except to change the URL line:
sURL = "sdbc:odbc:YOUR_ESTABLISHED_ODBC_CONNECTION"
Now for the user/PW see this post → Connect to mssql (ODBC) database via Macro