8 Replies Latest reply on Apr 7, 2017 11:51 AM by VasanthS

    Urgent: regarding PI Server connection using C++ ODBC

    VasanthS

      Hi Team,

       

      I am new to this PI Server, Wanted to execute sql query's in PI Sql commander part of migration project.

      What I have done is written a C++ application using ODBC where its connecting to my local MS Sql server using windows authentication and fetches data.

       

      Same application i'm trying to use to connect PI Server and execute query's. But, the connection is failed with below connection string. I do not have Pi server credentials like UID, Password so I am trying with windows authentication to login.

      Connection String:

      CONSTR=Driver={PI ODBC Driver};Server=[10.64.19.15];Provider Type=PIOLEDBINT;Initial Catalog=piarchive;Provider String ={Data Source=PI Servers;Integrated Security=SSPI;};

      Error:

      Message: [PIODBC] System.UriFormatException: Invalid URI: The hostname could not  be parsed.

      SQLSTATE: 08004

       

      Please let me know what i'm doing wrong here.

       

      Is it possible to connect PI Server using C++ ODBC which i coded for MS Sql Server? Or I need any specific SDK's to connect to PI Server?

       

      Please help me out.

       

      Thanks,

      Vasanth

        • Re: Urgent: regarding PI Server connection using C++ ODBC
          gregor

          Hello Vasanth,

           

          You should be able to connect to PI through PI ODBC with your C++ application.

          As indicated by the error message, your Data Source is not properly specified. Have you considered creating a DSN for your PI ODBC connection? The dialog as well allows you to test your connection which can turn out useful in case you are running into authentication issues.

            • Re: Urgent: regarding PI Server connection using C++ ODBC
              VasanthS

              Hello Gregor,

               

              Thanks for your immediate response.

               

              Now, I have changed my connection string,

              CONSTR=Driver={PI ODBC Driver};DAS=10.XX.XX.15;Trusted_Connection=Yes;DATA SOURCE TYPE=PIOLEDB;DATA SOURCE=PI Servers;DATA SOURCE OPTIONS={Integrated Security=SSPI;};

              with new one I'm getting below error

              ERROR [08004] [PIODBC] System.ServiceModel.EndpointNotFoundException: Could not connect to net.tcp://10.XX.XX.15:5462/DataAccessServer/Query. The connection attempt lasted for a time span of 00:00:00.9970000. TCP error code 10061: No connection could be made because the target machine actively refused it 10.XX.XX.15:5462.

               

              As you said I tried created DSN for PI ODBC Driver for both Data Source (PI Data Archive and PI AF Server)  and Test connection is failing and getting same error above. Please check attached image

              Please help me to address this issue.

               

              Thanks,

              Vasanth

            • Re: Urgent: regarding PI Server connection using C++ ODBC
              Marcos Vainer Loeff

              Hello Vasanth,

               

              Have you tested your PI ODBC query using PI SQL Commander Lite on the same computer running your C++ application? This is a good test to start troubleshooting.....

              • Re: Urgent: regarding PI Server connection using C++ ODBC
                VasanthS

                Hi Macros,

                To add a point, I just checked PI SQL Commander Lite and its does have only OLEDB Data Sources.

                Looks like ODBC Data Sources are not available.

                 

                Thanks,

                Vasanth

                  • Re: Urgent: regarding PI Server connection using C++ ODBC
                    gregor

                    Hello Vasanth,

                     

                    PI ODBC connects against PI SQL DAS (local or remote) which needs a local copy of PI OLEDB Enterprise (access to AF Server) and PI OLEDB Classic (access to PI Data Archive). The PI Data Archive is usually again installed remote to the PI SQL DAS. Please also see PI ODBC Driver Overview. Can you please make sure you have the required components installed?

                     

                    The current release PI ODBC Driver 2016 R2 includes PI SQL Commander Lite. If you don't have PI SQL Commander Lite, this indicates you either don't have PI JDBC Driver installed or it is an older version. Again, please check what's installed. If you need assistance with that or like us to verify dependencies, please include installed version numbers in your reply. You can obfuscate host names or IP addresses by replacing them with node1, node2 and so on but please make sure we can understand your architecture.

                     

                    The 10061 error can be due to your firewall blocking the port (5462). Please consider applying a rule on your PI SQL DAS host that allows incoming connections via port 5462 or take the firewall down - just for testing.

                  • Re: Urgent: regarding PI Server connection using C++ ODBC
                    VasanthS

                    Hi Gregor,

                    As I do not have ODBC Data sources listed in PI SQL Commander Lite, I have installed PI ODBC Driver 2015 Version 3.1.5.403. Then I could see ODBC Data Sourecs, So I tried configuring PI ODBC Data Source Name(DSN) but the test Connection is failed.

                    I tried with stopping pisqldas64.exe which is using 5462 port, after that also Test connection is failed. I also tried Turning off firewall but failed again.

                     

                    To add one more point, PIOLEDBTester.exe from below path is working.

                    C:\Program Files\PIPC\OLEDB\Tools64\PI OLEDB Tester\PIOLEDBTester.exe

                     

                    Please let me know with my current architecture, will I able to connect to PI Servers? Or I need to develop another application based on OLEDB to connect OLEDB Data Sources?

                    Please let me know your valuable inputs.

                     

                     

                    Thanks,

                    Vasanth

                    • Re: Urgent: regarding PI Server connection using C++ ODBC
                      VasanthS

                      Hi Gregor,

                      I have made connection with PI Server using ATL OLE DB. As ODBC is not supported in my environment.

                      Thanks a lot for your help guys.

                       

                      Thanks,

                      Vasanth