Are you sure the DSN is right? i.e., are you able to use $dbh for anything else? Since the do() returns 1, it sounds like a transaction issue, but i see that you have
AutoCommit => 1 in there.. a blind stab, but try
$dbh->commit after the do() ...
As for side notes, a couple things came to mind:
(The last two may not be needed/appropriate in your case, but definitely very good tools to be aware of.)
Update: I just read jZed's post, which has the very good point about $rows .. I guess i assumed it was 1 -- you should print it to confirm if it's 1 or 0E0 .. if the latter, then i would turn attention to $dat
1 and confirm that it really has the desired value..