bob_mechler
asked on
How do I save and retrieve a pdf in VB6 using SQL 2005 eXPRESS
I need a sample in VB6 or higher that will save an account number and a pdf in a blob (SQL_LONGVARBINARY) field or whatever field is best and retrieve it, save it as a file so that it can be used as a pdf by calling it from within the program.
Per the link below: The SQL engine supports 1 CPU, 1 GB RAM, and a 4 GB database size.
Note the limitation to 4 GB.
In addition, even though you can save binary(s) data (pdf, doc, xls, bmp, jpg,...) into the SQL database, most DBA's recommend against it. It can lead to bloat, corruption and other errors. Most recommend that you store the binary files to disk and create a pointer to the original file.
-------------------------- ---------- ---------- ---------- ----
SQL Server 2005 Express Edition Overview: Engine Specifications
http://msdn.microsoft.com/en-us/library/ms345154%28SQL.90%29.aspx#sseover_topic4
Note the limitation to 4 GB.
In addition, even though you can save binary(s) data (pdf, doc, xls, bmp, jpg,...) into the SQL database, most DBA's recommend against it. It can lead to bloat, corruption and other errors. Most recommend that you store the binary files to disk and create a pointer to the original file.
--------------------------
SQL Server 2005 Express Edition Overview: Engine Specifications
http://msdn.microsoft.com/en-us/library/ms345154%28SQL.90%29.aspx#sseover_topic4
ASKER
The PDF's need to be accessible to a web site in a DMZ zone that already can connect to the SQL Server in the Domain. The pdf's were on the computer in the DMZ in a folder and that was thought to be a security problem, which of course it is. My thought was to store the pdf's 32 k to 96 k per pdf in the same database we now populate the website with. No fuss, no muss.
If there is a less bloated way to save the pdf statements in the sql server (such as a different format), I'm all ears, but it needs to reside in the domain and only be accessible by a properly logged in user of the web site. Thanks
Bob
If there is a less bloated way to save the pdf statements in the sql server (such as a different format), I'm all ears, but it needs to reside in the domain and only be accessible by a properly logged in user of the web site. Thanks
Bob
I know there is a way to do this securely, but web dev is not my forte'. I've always had to address from the "local" applications that have been developed in our company.
I've asked to have the web dev/ ASP zones added to the Q.
I've asked to have the web dev/ ASP zones added to the Q.
ASKER
There are two parts to the issue. One part is as simple a program as possible to get the pdf's generated in the domain by our accounting programs into the SQL Server in the Domain. The part about getting them from that server and making a link available on the web site page can be handled by our web programmer. The Web programmer just knows about the SQL Server connection. My responsibility is for the accounting programs that use Btrieve API and PDFCreator.
Bob
Bob
Why do I have a feeling a kludge solution is in the making. ;-)
I spotted this link on the MSDN just below the info about SQL Express. I didn't read it in detail, but the difference between an mp3 and another binary is small, relatively. Maybe you could use that as the base code sample. And it has the advantage of being .Net ready (I hope ;-).
Managing a Music Collection Using Visual Basic Express and SQL Server Express
http://msdn.microsoft.com/en-us/library/ms345151%28SQL.90%29.aspx
I spotted this link on the MSDN just below the info about SQL Express. I didn't read it in detail, but the difference between an mp3 and another binary is small, relatively. Maybe you could use that as the base code sample. And it has the advantage of being .Net ready (I hope ;-).
Managing a Music Collection Using Visual Basic Express and SQL Server Express
http://msdn.microsoft.com/en-us/library/ms345151%28SQL.90%29.aspx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I'm currently testing some of the suggestions. A colleague tells me my code (not posted) retrieves a PDF from a LONGVARBINARY but only if it was placed there by another program. I'm assuming he used the ADO Stream object as acperkins suggested.
Bob
Bob
ASKER
Reviewing the code samples of acperkins I was able to use ADO in my environment to save and retrieve PDF'S.
http://www.fryan0911.com/2009/05/c-how-to-save-and-retrieve-image-to-ms.html
http://bytes.com/groups/net-asp/285827-saving-pdf-file-sql-server