as you seem to have spotted you can not access an online database directly via HTTP, you can however connect using telnet or SSH to a remote database if you have a valid username and password & the db is configured to accept remoth conections.
For accessing a database via a scripting language you have a fair choice of languages to choose from PHP,ASP,JSP,PHP,PERL,PHP,CFM and finally PHP (sorry spooks

)
all of the above can connect to various databases etc some to some extent, question is what exactly you want to do and where you want to do it - we need more info if we are to be af much help