There are all sorts of ways to do it (assuming you have the legal right to access the database).
You can write a program that runs on the site giving you secure access (login, etc.) to the database.
You can login to a shell account on the site and access the database with the help of a program running on the site.
You can delete a program on your laptop that accesses the remote database.
The best way for you depends on several things, such as what you need to do, what access you have to the site, what your abilities are, etc.