NI Home > Community > NI Discussion Forums

LabVIEW

Reply
Member GWJ
Member
GWJ
Posts: 8
0 Kudos

Database error -2147217865 for Execute Query VI

I am using the Database Connectivity Toolset to access a large Oracle database via complex SQL commands provided to me by a DB developer. It appears that I must use the DB Tools Execute Query VI followed by Fetch Record Set to return these potentially large tables. A very simple test command does work: [select sysdate from dual;]  so I know that my connection is ok.  I can also successfully use the List Tables VI to return all available table names.  However, when I execute an SQL command to read from a table [select count(*) from WO;] I get error -2147217865, saying that the table or view does not exist--but that table (WO) does appear in the array returned by List Tables. Other posts on this error point to connection problems or table name formatting problems, neither of which seem to apply to my situation. Ideas?
Gary Johnson
Member
Posts: 39
0 Kudos

Re: Database error -2147217865 for Execute Query VI

Does the user that you are using to connect with have the appropriate permissions on the tables?

I have found this error message quite useless, as it is usually an issue with the SQL statement rather than the labview code.  Are you able to attempt to run your queries on the command line using the same user name to see that the query will in fact work?
Member
Parny
Posts: 88
0 Kudos

Re: Database error -2147217865 for Execute Query VI

Can you check your query for any typos and also post the screen shot of your conenctions if possible?

See the below example image which works.

 

 

 

Trusted Enthusiast
mikeporter
Posts: 4,799
0 Kudos

Re: Database error -2147217865 for Execute Query VI

I would also be looking for a permissions problem. Very often a permissions problem will be reported as the table not existing.

 

Mike...

At NI-Week Checkout: A Dataflow Approach to Object-Oriented Programming - TS2879.


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"Safe? Who said anything about 'safe'? 'Course he's not safe - but he is good..."
Member GWJ
Member
GWJ
Posts: 8
0 Kudos

Re: Database error -2147217865 for Execute Query VI

Problem solved!  Mike Porter gets the cigar: it was in fact a permissions problem. My database administrator fixed it, and now I'm in business. Thanks, guys.
Gary Johnson
Trusted Enthusiast
mikeporter
Posts: 4,799

Re: Database error -2147217865 for Execute Query VI

Actually, ctardi got it right first... I just stood up and said "amen".

 

Mike...

At NI-Week Checkout: A Dataflow Approach to Object-Oriented Programming - TS2879.


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"Safe? Who said anything about 'safe'? 'Course he's not safe - but he is good..."