try: $dbh = DBI->connect($dsn, "uname", "pwd"); #prepare and execute the SQL statement $sth = $dbh->prepare("SELECT column FROM table WHERE TP_ID='X'"); $sth->execute; $sth->finish(); except: