3 Replies Latest reply on Jan 2, 2015 1:23 PM by Robert Krisher

    Establish a connection to a Px Database

    Ed Blair

      Am trying to follow the pattern in the ArcFM developer sample "AutomatedCleanup" to get a connection to a Px database, but it always errors with:

      PxError_000.png

      Always errors at line 112 below.  Am pointing to the sample WorkFlowManager database.  Any suggestions would be greatly appreciated.

       

      Ed

       

      (Note that when I try this with the user "admin" it errors with a message that the login name has no roles assigned... but this is the sample database and

      ADMIN has all roles assigned)

       

      PxError_001.png

        • Re: Establish a connection to a Px Database
          Samuel Tregillus

          Hi Ed,

           

          What happens if you don't provide any user id or password?  Just the path to the database (no trailing semicolon)? 

           

          Access databases usually don't actually care about the usernames.

           

          Also, what's the purpose of doing this on a Personal/Access database?  You wouldn't typically need to run the automated cleanup tool on an access database... the main purpose is to delete orphaned versions.  There are no versions in this environment, unless you have the access database as the process database, and the geodatabase as a separate SDE database.

            • Re: Establish a connection to a Px Database
              Ed Blair

              Sam -

               

              With no User Id provided I get the error that the user has no roles defined.

               

              I'm just trying to follow the pattern in the sample to get a connection to the PX database for another application purpose.  I couldn't get a connection in my app so tried to just get this sample to run -- which it doesn't seem to.

               

              Ed

                • Re: Establish a connection to a Px Database
                  Robert Krisher

                  Ed,

                    I typically will manually create and set the login connection.  If you just set the connection string, I could imagine that you may need to do something to force the connection to open / connect.  This is a bit of code I've seen work in the past for getting a connection:

                  var pxapp = new PxApplicationClass();
                  var pxlogin = new PxLoginClass();
                  IMMPxApplicationEx2 pxApplicationEx2 = null;

                  var connection = new ADODB.ConnectionClass();
                  connection.Open(pxconnectionString, pxUser, pxPass, -1);
                  pxlogin.Connection = connection;

                  pxapp.Startup(pxlogin);