I know very little about your database connection issue but,
Including
Code:
  
$ = SetOption("WrapAtEOL","ON")


At the beginning of your script may give you a more readable error message.

_________________________
Taxation WITH representation isn't so hot, either!