This requires two apps that you own/have access to. For clarity, we'll refer to the app with the shared database as the "server" app, and the one wanting to connect, the "client" app. This is not recommended nor supported by nanobox.
Note: You'll need to ensure NANOBOX_USERNAME and NANOBOX_PASSWORD are set on your "client" app
Fetch the nanobox binary. Run from your client component(s) in your client app