Welcome to Planning Planet, checkout the Guild of Project Controls Knowledge CAR

PMSDK: Connecting via standalone VB script (Visual Studio)

No replies
Vic A
User offline. Last seen 1 year 26 weeks ago. Offline
Joined: 24 Aug 2015
Posts: 2
Groups: None

Hi all,

I have looked at previous related topics and they have got me as far as the (hopefully last) hurdle. I get an error when my VB script tries to access the database through PMSDK. My setup is as follows;

  • I am running a standalone install of P6 Professional R8.3.2 with Oracle Database 11g Express Edition running locally;
  • I am using a 64-bit Windows 7 PC;
  • I have successfully installed and configured PMSDK using the 32-bit ODBC administrator;
    2582
    capture1.jpg
  • I have successfully configured the database in the Primavera DB configuration utility using the settings:
    • Database alias = PMSDK
    • Driver type = Oracle
    • Connection String = XE
    • Username AND password = pubprm$pm
    • Group ID = 1
  • The above settings result in a successful connection test.
  • Both MS Office and Visual Studio (Express Edition, 2013) are installed in Program Files (x86), but:
    • I am not trying to connect via MS Office application macros
    • The VS compile path does not contain parentheses
  • The code is simply a connection test example; (The project references Microsoft ActiveX Data Obects 6.1 Library. A lot of the other System libraries are located in the .NETFramework folder that is located in Program Files (x86) - could that be the problem?)


"Module Module1

    Sub Main()

        Dim SDK As ADODB.Connection

        Dim RecSet As ADODB.Recordset

        Dim lNumRecords As Long

        SDK = New ADODB.Connection

        Call SDK.Open("PMSDK", "pubprm$pm", "pubprm$pm")

        RecSet = SDK.Execute("SELECT * FROM PROJECT", lNumRecords, ADODB.CommandTypeEnum.adCmdUnknown)

        RecSet.MoveFirst()

        While Not (RecSet.EOF)

            MsgBox(RecSet.Fields("PROJ_ID").Value)

            RecSet.MoveNext()

        End While

        RecSet.Close()

        RecSet = Nothing

        SDK.Close()

        SDK = Nothing

    End Sub

End Module"

 

  • When compiled and run, the above script fails to connect to the database with the following error messages:


"An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in P6ConnectTest.exe

Additional information: [ATI][OpenRDA ODBC]RDA error: Resource not available - Connect error: =PMSDK;Driver=PMSDK;engine=PM;lf=C:\temp\PMSDK.LOG;lo=verbose;pg=1;pp=pubprm$pm;pu=pubprm$pm;.

Error returned from engine: Logon failed: invalid user pubprm$pm

    VDB.Connect; hResult=0x80040011 (PMSDK_E_BAD_LOGON: username/password or license invalid); EOleSysError=SDK failed to logon to driver

Error number: 0x80040011"

 

  • PMSDK.log gives more of the same:


"150824:22:47:01.862 - VDB.Connect: "pubprm$pm" using params=DB = PMSDK, Public Group Id=1, Log File Name=, LogOptions=verbose

150824:22:47:04.518 - Logon failed: invalid user pubprm$pm

150824:22:47:04.518 - ERROR => Logon failed: invalid user pubprm$pm

    VDB.Connect; hResult=0x80040011 (PMSDK_E_BAD_LOGON: username/password or license invalid); EOleSysError=SDK failed to logon to driver

150824:22:47:04.518 - VDB.Disconnect"

 

Does anybody know why this is happening and if anything can be done to correct it? Working with excel dumps is fast outliving its usefulness and it would be great to be able to work with the data directly. Any help is greatly appreciated.