Guild of Project Controls: Compendium | Roles | Assessment | Certifications | Membership

Tips on using this forum..

(1) Explain your problem, don't simply post "This isn't working". What were you doing when you faced the problem? What have you tried to resolve - did you look for a solution using "Search" ? Has it happened just once or several times?

(2) It's also good to get feedback when a solution is found, return to the original post to explain how it was resolved so that more people can also use the results.

Unable to configure SQL Server database connection for P6 v16R2

1 reply [Last post]
Pacita Tibay
User offline. Last seen 7 years 23 weeks ago. Offline
Joined: 16 Nov 2016
Posts: 2
Groups: None

Hi,

I upgraded our SQL server database for Primavera from v7 to 16R2.  No problem connecting to the database from Management Studio.

Installed P6 Professional R16.2-64bit on my laptop Win 7 OS.  When I tried to configure database connection, I got a Runtime error R6034 An application has made an attempt to load the C runtime library incorrectly.  Please contact the application's support team for more information.  This error was encountered after the step when Host Name and database name was entered and clicking next.

Anyone encountered similar issue?

Thanks for any help.

 

Replies

Zoltan Palffy
User offline. Last seen 4 weeks 3 days ago. Offline
Joined: 13 Jul 2009
Posts: 3089
Groups: None

here is the p6 fix

  1. Create a working directory (c:\tempextproc for example), and place the following code in a file called  getempno.pc  

    /* getempno.pc */

    #include <sqlca.h>
    #include <oci.h>
    int __declspec(dllexport) get_empno(OCIExtProcContext *epctx)
    {
    int empno=0;
    EXEC SQL REGISTER CONNECT USING :epctx;
    EXEC SQL SELECT empno INTO :empno FROM emp where ename='KING';
    return(empno);
    }
     
  2. Open a Visual Studio command prompt (Start > Programs > Microsoft Visual Studio 2008 > Visual Studio Tools > Visual Studio 2008 Command Prompt ,   and move the command prompt into that irectory.
     
  3. Set ORACLE_HOME and MSVCDIR environment variables by issuing the following at a command prompt (adjust paths for your environment):

    set oracle_home=D:\oracle\product\11.2.0\dbhome_1

    set MSVCDIR="D:\Program Files\Microsoft Visual Studio 9.0\VC"
  4. Precompile the .pc file using the following command (all on one line), which will result in the creation of getempno.c :

    proc iname=getempno.pc oname=getempno.c parse=full include=%ORACLE_HOME%\oci\include include=%ORACLE_HOME%\precomp\public include=%MSVCDir%\include
     
  5. Compile getempno.c with the following command (all on one line), which will result in the creation of getempno.dll 

    cl -I%ORACLE_HOME%\oci\include -I%MSVCDir%\include -I%ORACLE_HOME%\precomp\public -Zi getempno.c /LD /link %ORACLE_HOME%\oci\lib\msvc\oci.lib %ORACLE_HOME%\precomp\lib\orasql11.lib msvcrt.lib /nod:libcmt /DLL
     
  6. In this case, we'll copy the dll to %ORACLE_HOME%\bin for simplicity

    copy getempno.dll %ORACLE_HOME%\BIN\getempno.dll
     
  7. At this point, getempno.dll will have a dependency on MSVCR90.DLL which likely does not exist in the PATH, so it will need to be copied to %ORACLE_HOME%\bin, or the following error will result at runtime:

    ERROR at line 1:
    ORA-06520: PL/SQL: Error loading external library
    ORA-06522: Unable to load DLLERROR at line 1:
    ORA-06520: PL/SQL: Error loading external library
    ORA-06522: Unable to load DLL
    First, however, it will need to have the manifest incorporated into it or the following error will result at runtime:


    Microsoft Visual Studio C++ Runtime Library
    ==================================
    Runtime Error!

    Program: d:\oracle\product\11.2.0\dbhome_1\bin\extproc.exe

    R6034
    An application has made an attempt to load the C runtime library incorrectly.
    Please contact the application's support team for more information.
    To create the manifest, move the VS2010  command prompt into the MSVCRT redistributable folder and issue the following:

    cd %MSVCDIR%redist\x86\Microsoft.VC90.CRT

    mt.exe -manifest Microsoft.VC90.CRT.manifest -outputresource:msvcr90.dll;2
    for further information, refer to MSDN Documentation
     
  8. After incorporating the manifest, copy MSVCR90.dll to %OracleHome%\bin

    copy msvcr90.dll %ORACLE_HOME%\bin\msvcr90.dll
  9. Now, connect in SQL*Plus for example 

    sqlplus scott/tiger
    and create the library, create the procedure wrapper, and test it by running the code below

    drop library empnolib;
    /
    create library empnolib as 'D:\oracle\product\11.2.0\dbhome_1\bin\getempno.dll';
    /
    create or replace function get_empno
    return binary_integer as
    external library empnolib
    name "get_empno"
    language C
    with context
    parameters(context);
    /

    select getempno from dual;
  10.  
  11. also look at the microsoft fix

https://msdn.microsoft.com/en-us/library/ms235560(VS.80).aspx