You are right. Finally got it to work and the page load sped up significantly when I removed the images from the table query. This is super helpful!
There are two images in this table so I have created two named queries with different column names. Any idea why the 2nd column just won’t show up? Maybe the table doesn’t allow duplicate column names? Is there a way around this?
In your SQL, you have the column name for ContentType in single quotes. That is not valid SQL. Use double quotes for identifiers like schema, table, and column names.
The query worked fine, I got a row in the designer.
I changed quotes in SQL and change the url path (the project name was missing).
The blob serve module is running fine as well.
But no more data in PDF viewer
Did you save your project after fixing the named query? The Blob Server cannot work with unsaved changes. The Blob Server deliberately reports 404 when it gets no row or gets more than one.
Hi Phil, I hate to mention this after all the talk about it being free, and whether you should charge for it, etc, but the certificate on it expired on 7/8/22, 1:36:51 PM.
Yeah, I'm aware. I'll be generating a new certificate for my next batch of module updates. (Not going to buy one this time--Ignition itself doesn't care.)
I can confirm it is working great for me, don't have it in a production environment yet, but it is working fine in test. And yeah, Ignition doesn't seem to care about that certificate.
Hi Phil,
I am wondering how the Blob Serve module handles a Named Query with "Database Connection" set to <Parameter>. If Parameter is selected, the query will expect a "database" argument, but the Blob Serve documentation specifies that it silently ignores any extra parameters. Perhaps allow "database" as another valid argument?
For the time being, I'll just put all files into 1 database.
Good catch! I'll look at what it takes to do this.
Edit: Hmmm. I'm already allowing extra keys from the HTTP query string into the map the Named Query manager pulls the parameters from to execute. Not sure what I'm missing. In other words, the Named Query .execute() method does the silent ignoring for me. What have you tried?
Well, I just tried it out and it worked as expected. .../GetReport?database=somedatabase&id=someid
Sorry about that...I was reading up on things before writing the code to see if it was even possible.
This is great, now I can move all the pdf files back into their respective databases.
Phil -
First off, thanks for all your assistance in the forum. Your various comments and suggestions have saved me hours, if not days, of trial and error!
Question on the blob module for PDF viewing in Perspective:
I'm getting the same result as Damien (oct 2022 post)
Using MSSQLServer, I have a database table to store the record ID (autoinc), filename (varchar), data (varbinary), and datatype (varchar) for uploaded PDF files. I use the FileUpload component in perspective to get the file, and the component's onFileReceived event.file.getBytes() method to get the byte array. The upload to the database appears to work well.
Following your doc for use of the blob module, I have a named query that retrieves the data as 'Content' and datatype as 'ContentType' based on a record ID. ContentType is "application/pdf". The named query properly returns a single row with the correct column headings and what appears to be valid data.
I created a simple application for testing (gateway = localhost:8088). The project name is 'MyTest'. The named query for retrieval is at the path "GetPdfFile" in the Named Query root path.