system.db.runPrepUpdate throws java.lang.Exception

Hi ,
I am trying to follow an example regarding the file upload (onFileReceived)
Download and Upload Files - Ignition User Manual 8.0 - Ignition Documentation
I tried to save the uploaded file into my database but I get an error .
Is there a way to get more info about the error and what causes it ?

	# Grab the file name and data
fname = event.file.name
fdata = event.file.getBytes()
system.perspective.print(fname)
	     
# Use a query to insert the file
query = "INSERT INTO files (filename, filedata) VALUES(?, CONVERT(varbinary(MAX), ?))"
args = [fname, fdata]
try:
	system.db.runPrepUpdate(query,args,"Test")
	#system.perspective.print(newID)
except:
	system.perspective.print(sys.exc_info())	

error:

Please post the rest of the exception. Click on the “+” sign on the right in the gateway web interface, or open the wrapper.log file itself. Please paste it here (preferably as text using the “preformatted” button, not as a screenshot).

1 Like

following is from the wrapper

INFO | jvm 1 | 2021/09/09 15:44:57 | I [myLogger ] [13:44:57]: (<type ‘java.lang.Exception’>, java.lang.Exception: Error executing system.db.runPrepUpdate(INSERT INTO files (filename, filedata) VALUES(?, CONVERT(varbinary(MAX), ?)), [normal.json, [B@63cadafa], MSSQL, , false, false), <traceback object at 0x5>) view=z_Example/Apps/native-app@C, project-name=IgnitionTPM_POC, component=root/Native Applications/Small/File Upload/FileUpload

in the gateway logs there is no + sign next to this line

What happens if you run system.db.runPrepUpdate(query,args,"Test") in script console? You should get a full stack trace then. Run it without a try/except.