From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I save documents like PDF or docx files from LabVIEW to SQL server

Write data to SQLWrite data to SQLRead data from SQLRead data from SQLAnother Read data from SQLAnother Read data from SQL

 

 

 

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.

 

0 Kudos
Message 1 of 2
(2,287 Views)

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.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 2 of 2
(2,223 Views)