Jump to content

lisam

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by lisam

  1. damn, that seemed like a great method. Do you know of any method that will work on linux? I've been following a tutorial for LabVIEW to PostgreSQL for Linux RT using the system exec VI, (https://decibel.ni.com/content/docs/DOC-30308) which works but it opens and closes the connection every time data is inserted (unless I string all the values together first - which isn't very efficient). Another suggestion is using the Call Library Function Node - but I can't find any examples with a PostgreSQL API.
  2. Hi Mikael, thank your suggestion and help! I managed to connect to my db using open and close connection invoke nodes and execute a query using ADO execute. Thanks very much indeed. My only question: do you know if ADO compatible with Linux Real-Time cRIO? Thanks for your time, it is much appreciated. Lisa
  3. Hi all. I recently got the Database Connectivity Toolkit (DBCT) on LabVIEW 2016 and I'm trying to insert multiple rows into a database. Using a sine signal input I attempted to insert 50 rows in one iteration, but every method I tried returned 50 values in one row. Using the end of line constant and array to spreadsheet string, returned what looked like 50 rows, but when I queried "SELECT COUNT(*) FROM.." the no of rows was equal to the number of iterations. On another forum post, someone suggested it is not possible to insert multiple rows using the DBCT. Can anyone confirm this? I have written some code which allows me to insert 3 rows in one iteration, under a single connection. However, this method is very tedious and wouldn't work for large amounts of data. Can anyone think of a better way to do this? Thanks in advance, Lisa
  4. Hi Tim, many thanks for your response. I managed to get it working correctly when I disabled the select query. So I suspect the fact they were parallel was the issue. Thanks again.
  5. I am looking to determine the time it takes to insert each batch (500rows) of data into a database, i.e. the loop execution time. See the block diagram below. I've place a timer outside the while loop and subtracted it from the timer inside the loop, using shift registers to carry forward the start time. I place the timer in a sequence structure to make sure it starts before the code runs. When I used this method on a simple example - a while loop with wait function, the loop execution time returned the wait time as expected. But in the database application, the loop execution time value continues to increase. Where am I going wrong? Thanks in advance, Lisa
  6. I am trying to connect a PostgreSQL database (ver 9.6) with LabVIEW (2016) on Windows 10. I followed the following tutorial: https://decibel.ni.com/content/docs/DOC-30308 Without access to a cRIO, I have followed the steps to create the database, table and block diagram. Please see block diagram attached.The system exec.vi calls the psql.exe with SELECT command using database "lisam" and database user "postgres". When I execute the same code I am asked for the password for user postgres. When I type in the password, the box closes and reopens. This continues in a loop until I press abort. I get no errors and when I write the same script into the cmd - the password is accepted and the table is displayed, see attachment. PROBLEM: Password request from the psql.exe file when executing LabVIEW code Type password, psql.exe closes and opens again SELECT query works without while loop (password accepted once) but insert and clear does not without the loop condition What I've tried... Created a pgpass.conf file in a postgresql folder in %AppData% in the following format:- hostname:port:database:username:password, where lisam is the database, postgres is the user. Host name as localhost '127.0.0.1' - password still requested. 127.0.0.1:5432:lisam:postgres:password Host name as 'localhost' - psql.exe flashes continously and LabVIEW crashes. localhost:5432:database:username:password Host name as database client address '::1' - password loop with the psql.exe. ::1:5432:database:username:password Host name to '*' - *:5432:lisam:postgres:password Able to: Access the database through the cmd WITHOUT password C:/Program Files/PostgreSQL/9.6/bin/psql -c "SELECT * FROM demo1" lisam postgres Problems: Execution in Labview - psql.exe flashes continuously and the program crashes. Accessing database through psql.exe directly - password requested and ERROR received "psql: FATAL: password authentication failed for user C:\Program Files" 2.Changed the authentication method in pg_hba.conf to trust for: localhost (127.0.0.1)- a password is still requested. 127.0.0.1 AND ::1 - Can access the database on psql without a password, but the psql.exe LabVIEW completely crashes. I tried adding the host and port to the code C:/Program Files/PostgreSQL/9.6/bin/psql -c "%s" -h 127.0.0.1 -p 5432 lisam postgres And the psql.exe flashes continously and won't abort. The password is called at the system exec VI in the cmd. Tried concatenating the password (as a control) with space constant to the command line string inbetween the format into string and the system exec VI. But the password is given before it is called. In summary I am able to use .pgpass.conf to authenticate the password when using the cmd, but not in LabVIEW. Does anyone know a way around this? Or another way to define the password at the system exec VI? Your help is greatly needed. Lisa Info: database name: lisam database user: postgres IPv4 local connections- host all all 127.0.0.1/32 md5 IPv6 local connections- host all all ::1/128 md5 DB:lisam Client Address ::1 psql Client address 127.0.0.1
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.