LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

LabWindows/CVI 8.01 ActiveX SQL access denied.

Merry Christmas to everyone here !
 
It seems not right time to post a question now. But I have spent last two days on this issue. And I will feel more relaxed if I speak it out before going to the long weekend.
 
I encountered a problem to run a ADO 2.8 funtion which calls CVI 8.01 ActiveX automation function CA_CreateObjectByClassIdEx to create an object to access a SQL database. The returned error code is: -2147024891 which means "Access is denied". I use LabWindows/CVI v8.01. Its cviauto.dll is dated on 4/10/2006 10:00am. But the same program runs fine with CVI v7.0.
 
There must be something weird with CVI V8.01 on ActiveX automation. From NI website, it says CVI v8.1 has improvement on ActiveX. I don't know it will fix this problem or not. Is there any other solution other than buying CVI v8.1?
Thanks,
0 Kudos
Message 1 of 23
(4,974 Views)
Any input is highlly appreciated. Please help !
 
Thank you,
0 Kudos
Message 2 of 23
(4,927 Views)
Hi luyy,

Did you use the ActiveX Controller Wizard to generate wrappers around these ActiveX servers? The reason I ask is that you mentioned using a low-level ActiveX function, CA_CreateObjectByClassIdEx.  If you didn't use the wizard (Tools >> Create ActiveX Controller), try this wizard and see if you can simply load your program without making any function calls. Our generated wrappers use those low level ActiveX calls. Also check out the posted example on this
post (ADO 2.7 but still something to test).  See if you can run that example (you would have to change up the DSN info) but you should be able to still load the example. 

Sometimes access denied deals with DCOM settings on computers. Are you running the CVI 7.0 and 8.0.1 on the same machine different machines?

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 3 of 23
(4,905 Views)

Jonathan,


Thank you for the reply.

I put CVI 7.0 and CVI 8.01 on two different PCs to avoid the potential confusion or conflict.

The ADO2.8 function that I mentioned in my first post is in my ADO28_luyy.fp which was generated by ActiveX Controller Wizard. Then this function ADODB_New_Connection calls the low level CA_CreateObjectByClassIdEx which always returned negative error code on CVI 8.01 . The source code for this ADO function is listed below:

HRESULT CVIFUNC ADODB_New_Connection (const char *server,
                                      int supportMultithreading, LCID locale,
                                      int reserved, CAObjHandle *objectHandle)
{
 HRESULT __result = S_OK;
 GUID clsid = {0x514, 0x0, 0x10, 0x80, 0x0, 0x0, 0xAA, 0x0, 0x6D, 0x2E,
               0xA4};

 __result = CA_CreateObjectByClassIdEx (&clsid, server,
                                        &ADODB_IID__Connection,
                                        supportMultithreading, locale,
                                        reserved, objectHandle);

 return __result;
}

In addition, I have one question. While I was creating my ADO28_luyy.fp, on the screen "ActiveX Controller Wizard - Choose Server", I chose "Microsoft ActiveX Data Objects 2.8 Library". Is this right?

Furthermore, I ran the example code "adotest" on both CVI7.0 and 8.01. To my surprise, both complainted "ActiveX control not registered on this computer" when the LoadPanel(..) function in the test.c was being executed. I am not sure how to set DCOM setting on a Windows XP Professional PC. Could you tell me?

I think it may be easier for you if  I attached the source code for the ADO28_luyy.fp here.

 

Thank you again,

0 Kudos
Message 4 of 23
(4,901 Views)

Jonathan,

I lost the attachment when I posted  the last post. Here it is:

Thank you,

0 Kudos
Message 5 of 23
(4,902 Views)
Jonathan,
 
One more thing I forgot to mention is: the SQL server is on the third PC which is located in our company's IS Dept.. Not on my any PC.
 
Thanks,
 
 
0 Kudos
Message 6 of 23
(4,901 Views)
Hi luyy,
 
You are correct when using Microsoft ActiveX Data Objects 2.8 as the ActiveX server in the ActiveX Controller Wizard.  What happens if you use the NULL parameter for the server in the New_Connection function? For example, what return value do you get if you say:
 
result = ADODB_New_Connection (NULL, 1, LOCALE_NEUTRAL, 0, &ConnectionObj);
 
This should make the server your current machine. If it doesn't return an error, then maybe you have some DCOM settings you need to change on your remote machine.  To double-check if this is the case, either:

- Take your CVI 7.1 code and run it on the 8.0.1 machine (since the 7.1 code works) and see if you get errors.
- Take your CVI 8.0.1 code and run it on the 7.1 machine.
 
As far as DCOM settings, see this post for some guidance
 
Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 7 of 23
(4,903 Views)

Jonathan,

Thank you for the excellent support.

After I changed the server name to NULL, the returned 'result' value is '0'.

My original code works fine for my CVI 7.0 machine, but not on CVI 8.01 machine.

My CVI 8.01 machine is a new PC which I got two weeks ago. Do you think it is very likely the remote machine (SQL server / ActiveX server ) doesn't set my CVI8.01 machine into the remote machine's DCOM setting?

 

Thanks,

 

 

 

0 Kudos
Message 8 of 23
(4,900 Views)
Hi luyy,
 
Based off the results of changing the server parameter to NULL, it sounds like some security DCOM settings. The post I mentioned earlier describes setting up some of the DCOM security settings.  You may even want to get your IT people in on this because they may know what settings they configured for your CVI 7.0 machine. If you wanted to be absolutely sure, following the suggestions of porting the code over to different machines would verify this.
 
Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 9 of 23
(4,898 Views)
Jonathan,
 
I got IS people involved. However, they haven't found anything wrong about security and DCOM settings. Nevertheless, I have something interesting.
 
I put my executable application code built by CVI7.0 into my CVI 8.0 machine, it didn't work and got the same thing "Access is denied" when it tried to connect to the SQL database using. Then I copied the CVI 7.0 cviauto.dll dated on 7/29/2003 9:00AM into my application code directory ( not windows\system32 directory) but left all CVI 8.0 DLL files including cvirte.dll and cviauto.dll in Windows\System32 directory untouched. Then I ran my CVI7.0 application. It worked.
 
I also installed my CVI8.0 executable application code into another Windows XP PC. It got the same error "Access is denied".
 
So what do you think?
 
Thanks,
 
0 Kudos
Message 10 of 23
(4,818 Views)