10-25-2019 01:43 AM
Hi all,
I have an application where I am trying to save a document (.pdf, .docx, .xlsx etc) into SQL, but it is proving difficult. I have used this National Instruments resource (http://www.ni.com/pdf/manuals/371525a.pdf), the Database Connectivity Toolkit User Manual to design a basic application which allows me to use certain data types (chapter 4) to input data into SQL server, I can also read my written data.
But is there a way I can insert documents into the server and retrieve/read the document later on as well? If anyone has done this before, it would be great if you can share how you did it please.
I have attached a picture of my basic code on how I write and read data. I used the Database Connectivity Toolkit.
10-25-2019 09:30 AM
Databases store their data in tables which a generally limited to the datatypes allowed by the database itself. Strings, Ints, Floats, etc. Most have some kind of BLOB which is a Binary Large OBject that would allow you to store a big file like a PDF or JPG but you would have to convert the PDF to a binary stream that the database would accept. Then, you would have to convert it back when you read it back. I'm not sure how to do that easily in LabVIEW.
Much easier is to simply store the big file (PDF, Image, Video or whatever) in a safe file location and then store just the path to it in the database.