VMware Cloud Community
slaser
Contributor
Contributor
Jump to solution

Attempting to transfer a bytea file from a Postgresql database field to the file store on the Orchestrator.

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?

Reply
0 Kudos
1 Solution

Accepted Solutions
cdecanini_
VMware Employee
VMware Employee
Jump to solution

You will have to use the filewriter javascript object (and check how to enable permissions for it)

Or will have to configure a shutter file to enable vCO to use java.file.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter

View solution in original post

Reply
0 Kudos
2 Replies
cdecanini_
VMware Employee
VMware Employee
Jump to solution

You will have to use the filewriter javascript object (and check how to enable permissions for it)

Or will have to configure a shutter file to enable vCO to use java.file.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
Reply
0 Kudos
slaser
Contributor
Contributor
Jump to solution

Followed directions in the Installation manual to add the JAVA classes to shutter file configuration.  Thank you for your help.

Reply
0 Kudos