Please look into the Perl bindings. If nothing else, it will provide an automated connection to the database, either through parsing of the mysql.txt/config.xml files or UPnP autodetection, without having to manually specify its location.