6 Replies Latest reply on Dec 1, 2015 11:43 AM by larsoleruben

    Not able to connect with jdbc

    larsoleruben

      Hi

      I am trying to use the JBDC driver to connect to PI. I keep on getting this exception when trying from the getSnap sample:

      java.sql.SQLException: Could not connect using none of the specified protocols.

              at com.osisoft.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:148)

              at com.osisoft.jdbc.DriverExtension.connect(DriverExtension.java:211)

              at com.osisoft.jdbc.Driver.connect(Driver.java:272)

              at java.sql.DriverManager.getConnection(Unknown Source)

              at java.sql.DriverManager.getConnection(Unknown Source)

              at getSnap.main(getSnap.java:30)

       

      PI SQL Commander and Commander Lite works fine with the same SQL DAS?

      Any ideas?

       

      Use the enclosed source code and set debug level higher. This error is due to a conflict between the jbdc driver and sql das server.

      But that did not solve it completely. I had to change the code for the sql driver as follows:

      plist.put("TrustedConnection", "true");

       

      What does that exactly mean?

       

       

       

       

      regards

      Lars

        • Re: Not able to connect with jdbc
          gregor

          Hello Lars,

           

          This appears to be PI JDBC 2015. Please confirm.

          Looking at the manual page 8, there's the following note:

           

           

               On first use you will see the security login (page 8) dialog. You can also modify the sample and set plist.put("TrustedConnection", "True"); in which case you use trusted Windows Authentication.

           

          Indeed the manual is wrong about the page showing the login dialog (page 10) but by default, getSnap prompts for credentials.

           

            • Re: Not able to connect with jdbc
              larsoleruben

              Hi

               

              Yes you are correct, it is the latest edition of the odbc driver.

               

               

              Kind regards / Med venlig hilsen

              Lars Ole Ruben Christoffersen

                • Re: Not able to connect with jdbc
                  gregor

                  Hello Lars,

                   

                  Please accept my apologies but I am unsure what your question is really about. Do you like to understand what it means to request a trusted connection with PI JDBC? If this is not the case, can you please re-phrase your question?

                   

                  getSnap is connecting against PI Data Archive through PI OLEDB (Classic) Provider. PI OLEDB (Classic) uses PI SDK for communication. When requesting for a trusted connection to the PI Data Archive with PI JDBC, authentication can either be through Windows Integrated Security (PI Mapping) or via a PI Trust. What's used and in what order, depends on the PI SDK client configuration. You can verify what's used e.g. by looking at the PI Message Log on the PI Data Archive node (PI Server Log) or at PI Network Manager Statistics for an active connection.

                   

                  The error message you've posted is pretty generic and doesn't really contain information about what went wrong. To get a better understanding, you would need to look at the PI JDBC log. PI JDBC logging becomes enabled through driver property LogLevel (0-5) and LogFile (e.g. LogFile = C:\Temp\PI-JDBCLog.txt). Please do not mix up driver properties with connection string parameters. With verbose logging (LogLevel=5) the log should have clear information about what exactly caused the failure.

                  1 of 1 people found this helpful
                    • Re: Not able to connect with jdbc
                      larsoleruben

                      Hi

                      Sorry for being unclear.

                      My first problem was testing the connection with getSnap.class. I got an exception every time, saying "Could not connect using none of the specified protocols."

                      I then loaded the source code and debugged it from eclipse and found the following:

                       

                      1) The 2015 jdbc is not compatible with the 2012 SQLDas server.

                      2) Secondly I had to change plist.put("TrustedConnection", "false"); to plist.put("TrustedConnection", "true");

                       

                      I just wondered what that (number 2) actually meant for security and connectivity you do that.

                      But I did get it to connect and I can query the PIServer.

                       

                      Regards

                      Lars