Attempting to transfer a bytea file from a Postgresql database field (SQL instance on Orchestrator) to the file store on the Orchestrator.
Code is as follows:
var query = "Select * from lots where id = '" + vmID + "'";
var resultRecords = database.readCustomQuery(query);
var icaoData = resultRecords[0].getProperty("icaodatabase_file_data");
var out = new java.io.FileOutputStream("/var/run/vco/" + resultRecords[0].getProperty("icaodatabase_file_name"));
out.write(icaoData)
out.flush()
out.close()
Error received: TypeError: [JavaPackage java.io.FileOutputStream] is not a function, it is object.
This works fine in Grails. Any suggestions on how to achieve success in Orchestrator 5.5?