10-13-2016 08:39 AM - edited 10-13-2016 08:59 AM
Hi,
I am trying to write some data on LabVIEW and insert it into a local postgreSQL database. I tried to follow the example below (screen shot of example also attached) using format into the string function and system exec.VI:
https://decibel.ni.com/content/docs/DOC-30308
I get an error message stating:
"Error 2 occurred at System Exec.vi. Command was /usr/bin/psql -c "SELECT * FROM test" mydb". Possible reason: LabVIEW memory is full?
I am using postgresql 9.6 and LabVIEW 2016.
Thanks in advance,
Lisa
10-13-2016 09:30 AM
It appears that the error code is coming from your Command to read the database. Have you verified that the database has been installed correctly and it is even possible to execute the Select command?
Try going to a command prompt and typing the following:
Did this do something that is "meaningful"? What do you get from Standard Out and Standard Error?
If this works, try "by hand" the other psql commands. Let us know the results.
Bob Schor
10-13-2016 10:19 AM - edited 10-13-2016 10:20 AM
Hi thanks for your comment. I managed to get it to execute by finding the actual location of the psql.exe in my c drive. ..
C:/Program Files/PostgreSQL/9.6/bin/psql -c "%s" mydb
However now the psql.exe pops up asking for a password. Any ideas what this could be? or how to prevent the need for a password?
10-13-2016 10:19 AM - edited 10-13-2016 10:21 AM
10-13-2016 04:35 PM
Now you are asking a PostgreSQL question. Go to their site and see what they say.
Bob Schor
10-14-2016 05:15 AM
@lisam88 wrote:Hi thanks for your comment. I managed to get it to execute by finding the actual location of the psql.exe in my c drive. ..
C:/Program Files/PostgreSQL/9.6/bin/psql -c "%s" mydb
However now the psql.exe pops up asking for a password. Any ideas what this could be? or how to prevent the need for a password?
I would wager there's something like a -p option for providing a password.
/Y
10-14-2016 06:07 AM - edited 10-14-2016 06:18 AM
Thanks for your help, it is much appreciated . In the psql guide there are only two options regarding passwords:
There is no option to provide the password as a command line argument because that information is often available to all users, and therefore insecure.
I have a password contained in configuration file .pgpass.conf. Perhaps I can put this into the labview code? Would you know how to do this?