A segfault is a rather extreme error, try below in a step by step manner to try isolating where/what is causing it.
Specifically:
- I'll assume you're using use strict and -w :).
- You're using double quotes around the dbi:ODBC:datasource where you should be using single quotes. Double quotes interpolate, single don't.
- Next you could add some more error handling $sth = $dbh->prepare("SELECT * FROM table") or die "error message here" and other locations to help track it down (and strictly speaking prepare isn't needing for a query like this but that's a non-issue).
In General: