I have a very large MS Access database and I am trying to extract an OLE field as part of my report (currently txt file but will eventually RTF or PDF format)
Code:
use DBI;
use User;
use PDF::Create;
use Win32::OLE;
#Open output txt file
open ( FILE_NAME_STD, ">C:\\database\\out.txt") || die "cannot open file: $!\n
#open connection to STD database
$dbhSTD = DBI->connect('dbi:ODBC:driver=microsoft access driver (*.mdb);dbq=c:\\database\\db1');
$dbhSTD->{'LongTruncOk'} = 0;
$dbhSTD->{'LongReadLen'} = 65535 ;
$dbhSTD->{'AutoCommit'} = 0;
#Get Appendix E Picture
#construct SQL statement
$sqlstatementAppendixEPicture = "SELECT `APPENDIX E`.Picture
FROM `c:\\database\\db1`.`APPENDIX E` `APPENDIX E`
WHERE (`APPENDIX E`.CSCI='Type1')";
#prepare and execute SQL statement
$sthAppendixEPicture = $dbhSTD->prepare($sqlstatementAppendixEPicture);
$sthAppendixEPicture->execute ||
die "Could not execute SQL statement, maybe invalid?\n\n$sthAppendixEPicture\n\n";
#there is only one record using the WHERE clause
@rowSTD=$sthAppendixEPicture->fetchrow_array;
print FILE_NAME_STD "$rowSTD[0]\n";