Be 'very' x 100 careful. This could cause a security hole that you could park a buick in. I would personally recommend DBI. Using DBI is probably quicker too, because you don't have to start another process. I haven't benchmarked it, so I'm not positive.
I can tell you from experience that connecting the DBI way is much faster. We have Sybase, and two scripts checking ~1000 documents takes 59.23 using isql from the command line, and take 3:07 using DBI. The basic thing is that you have the disk read overhead.