I agonised over this for days - my tip is to make sure you are connected to the Internet then at the Dos prompt type:
or something along those lines.
If you are not connected to the Internet then it seems to go through the motions but when you call the dbi function from the script it cannot find it. Also, make sure you are using the equivalent versions of mysql and phpmyadmin (if you are using them) and install the relevent packages for sql.
Hope this helps you avoid some of the headaches I had.