You might want to try outputting some debugging info which brackets the connection.
i.e.
1- output to log (time, some-unique-id, opening-connection)
1a - output to log (time, open successful | open fail)
2- access dsn
3- perform queries
4- output to log (time, some-unique-id...