Results 1 to 9 of 9
  1. #1
    Join Date
    Dec 2003
    Posts
    78

    Unanswered: embedded stored procedure compile error

    Hello, i have a simple stored procedure static.sqc file

    ***********
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include "utilemb.h"
    #include <sqlda.h>
    #include <sqlca.h>
    #include <sqludf.h>
    #include <sql.h>
    #include <memory.h>
    #include <sqltypes.h>

    EXEC SQL INCLUDE SQLCA;

    int main(int argc, char *argv[])
    {
    int rc = 0;
    char dbAlias[15] ;
    char user[15] ;
    char pswd[15] ;

    EXEC SQL BEGIN DECLARE SECTION;
    char firstname[13];
    EXEC SQL END DECLARE SECTION;

    /* checks the command line arguments */
    rc = CmdLineArgsCheck1( argc, argv, dbAlias, user, pswd );
    if ( rc != 0 ) return( rc ) ;
    printf("\n\nSample C program: STATIC\n");
    /* initialize the embedded application */
    rc = EmbAppInit( dbAlias, user, pswd);
    if ( rc != 0 ) return( rc ) ;
    EXEC SQL SELECT FIRSTNAME INTO :firstname
    FROM employee
    WHERE LASTNAME = 'JOHNSON';
    EMB_SQL_CHECK("SELECT statement");

    printf( "First name = %s\n", firstname );

    /* terminate the embedded application */
    rc = EmbAppTerm( dbAlias);
    return( rc ) ;
    }
    /* end of program : STATIC.SQC */
    ***********



    I 'm working in Windows XP, and have the compiler Microsoft Visual Studio C++.

    I have written bldmstatic.bat file to compile,
    It gives the below error:



    ****************
    C:\PROGRA~1\SQLLIB\bin\my_sps>bldmstatic static

    Database Connection Information

    Database server = DB2/NT 7.2.6
    SQL authorization ID = DB2ADMIN
    Local database alias = TRIAL2


    LINE MESSAGES FOR static.sqc
    ------ --------------------------------------------------------------------
    SQL0060W The "C" precompiler is in progress.
    SQL0091W Precompilation or binding was ended with "0"
    errors and "0" warnings.

    LINE MESSAGES FOR static.sqc
    ------ --------------------------------------------------------------------
    SQL0060W The "C" precompiler is in progress.
    SQL0091W Precompilation or binding was ended with "0"
    errors and "0" warnings.

    LINE MESSAGES FOR static.bnd
    ------ --------------------------------------------------------------------
    SQL0061W The binder is in progress.
    SQL0091N Binding was ended with "0" errors and "0" warnings.
    DB20000I The SQL command completed successfully.

    C:\PROGRA~1\SQLLIB\bin\my_sps>rem Compile the program.

    C:\PROGRA~1\SQLLIB\bin\my_sps>if exist "static.cxx" goto cpp

    C:\PROGRA~1\SQLLIB\bin\my_sps>cl -Z7 -Od -c -W2 -D_X86_=1 -DWIN32 static.c
    Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
    Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

    static.c
    C:\Program Files\Microsoft Visual Studio\VC98\include\sqltypes.h(114) : error C2
    061: syntax error : identifier 'SQLHWND'
    C:\Program Files\Microsoft Visual Studio\VC98\include\sqltypes.h(114) : error C2
    059: syntax error : ';'
    C:\Program Files\Microsoft Visual Studio\VC98\include\sqltypes.h(252) : error C2
    061: syntax error : identifier 'DWORD'
    C:\Program Files\Microsoft Visual Studio\VC98\include\sqltypes.h(253) : error C2
    061: syntax error : identifier 'Data2'
    C:\Program Files\Microsoft Visual Studio\VC98\include\sqltypes.h(253) : error C2
    059: syntax error : ';'
    C:\Program Files\Microsoft Visual Studio\VC98\include\sqltypes.h(254) : error C2
    061: syntax error : identifier 'Data3'
    C:\Program Files\Microsoft Visual Studio\VC98\include\sqltypes.h(254) : error C2
    059: syntax error : ';'
    C:\Program Files\Microsoft Visual Studio\VC98\include\sqltypes.h(255) : error C2
    061: syntax error : identifier 'Data4'
    C:\Program Files\Microsoft Visual Studio\VC98\include\sqltypes.h(255) : error C2
    059: syntax error : ';'
    C:\Program Files\Microsoft Visual Studio\VC98\include\sqltypes.h(255) : error C2
    059: syntax error : '['
    C:\Program Files\Microsoft Visual Studio\VC98\include\sqltypes.h(256) : error C2
    059: syntax error : '}'

    C:\PROGRA~1\SQLLIB\bin\my_sps>goto link_step

    C:\PROGRA~1\SQLLIB\bin\my_sps>rem Link the program.

    C:\PROGRA~1\SQLLIB\bin\my_sps>link -debug:full -debugtype:cv -out:static.dll -dl
    l static.obj db2api.lib -def:static.def
    Microsoft (R) Incremental Linker Version 6.00.8168
    Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

    LINK : fatal error LNK1181: cannot open input file "static.obj"

    C:\PROGRA~1\SQLLIB\bin\my_sps>rem Copy the stored procedure DLL to the 'function
    ' directory

    C:\PROGRA~1\SQLLIB\bin\my_sps>copy static.dll "C:\Program Files\SQLLIB\function"

    The system cannot find the file specified.
    ****************

    It finds error in sqltypes.h
    What does that mean? How can i correct the problem?

    Thanks guys
    SHEDB

  2. #2
    Join Date
    Nov 2003
    Location
    Netherlands
    Posts
    96

    Re: embedded stored procedure compile error

    Originally posted by shedb

    It finds error in sqltypes.h
    What does that mean? How can i correct the problem?

    Thanks guys
    SHEDB
    I'm not sure but you might need to put the DB2 SQLLIB/INCLUDE directory in front of other 'include' directories. Maybe during compilation the wrong sql* files are used.

    Hope this helps.

  3. #3
    Join Date
    Dec 2003
    Posts
    78

    Re: embedded stored procedure compile error

    Hi, thanks GertK,
    I will implement your suggestion. But i don't have the file sqltypes.h in sqllib\include directory.
    Would you or anyone who read this message , if you have the sqllib\include\sqltypes.h file, could you send or reply with the open source code of this header file?
    Thanks a lot again, i hope this works
    Byss

  4. #4
    Join Date
    Apr 2003
    Posts
    191

    Re: embedded stored procedure compile error

    Hi,

    if you can't find files needed for development, you may have installed the wrong product, or just didn't install development support.

    I can't tell about the bundling for version 8, but in version 7 you needed either an enterprise edition or a developer edition to do development stuff.

    Another possibility is you forgot to install development packages from the installation media. Run db2setup again.

    Johann

    Originally posted by shedb
    Hi, thanks GertK,
    I will implement your suggestion. But i don't have the file sqltypes.h in sqllib\include directory.
    Would you or anyone who read this message , if you have the sqllib\include\sqltypes.h file, could you send or reply with the open source code of this header file?
    Thanks a lot again, i hope this works
    Byss

  5. #5
    Join Date
    Dec 2003
    Posts
    78

    Red face

    thanks Johann,
    I installed EE with application builder and db2 is working well, also stored procedure builder is working well. so i suspect that i may have deleted that file esp.Because there appears many header files in that directory other than sqltypes.h

    To be honest, i fear to reinstall DB2 because if anything goes wrong, there is a lot of DB2 work request loads in the office so i dont want to cause any delay.
    So, before trying to reinstall it, i want to try with sqlib\include\sqltypes.h header file, if anybody can send or copy the source down here.

    If that does not work, i will do what you suggest Johann.Thanks a lot again.

    So i will be pleased if anyone can send here sqllib\include\sqltypes.h
    For DB2 version 7.2

    Thanks all

  6. #6
    Join Date
    Apr 2003
    Posts
    191
    Hi,

    well, in our installation, which happens to be on AIX, I can't find a file like that. Suppose you try and retrieve the file from the installation media. This should work probably from a fixpack .zip file as well.

    Johann

    Originally posted by shedb
    thanks Johann,
    I installed EE with application builder and db2 is working well, also stored procedure builder is working well. so i suspect that i may have deleted that file esp.Because there appears many header files in that directory other than sqltypes.h

    To be honest, i fear to reinstall DB2 because if anything goes wrong, there is a lot of DB2 work request loads in the office so i dont want to cause any delay.
    So, before trying to reinstall it, i want to try with sqlib\include\sqltypes.h header file, if anybody can send or copy the source down here.

    If that does not work, i will do what you suggest Johann.Thanks a lot again.

    So i will be pleased if anyone can send here sqllib\include\sqltypes.h
    For DB2 version 7.2

    Thanks all

  7. #7
    Join Date
    Dec 2003
    Posts
    78
    Hi,
    i can not find the right file on internet or any other source.
    Please, if anyone has sqllib\include\sqltypes.h file for windows db2 v7.2
    can you copy here????
    tnx

  8. #8
    Join Date
    Nov 2003
    Location
    Netherlands
    Posts
    96
    Originally posted by shedb
    Hi,
    i can not find the right file on internet or any other source.
    Please, if anyone has sqllib\include\sqltypes.h file for windows db2 v7.2
    can you copy here????
    tnx
    Maybe it will compile without the include ?

  9. #9
    Join Date
    Dec 2003
    Posts
    78
    Hello all
    i finally found the answer by microsoft support
    i don't need sqllib\include\sqltypes.h
    i just needed to write " #include <windows.h> " at the top of all include!!

    ..well, of course after that step, i unsurprisingly encountered another problem.
    The same compile window tells unable to open static.def file.

    the problem is , i don't know how to write the static.def for my static.sqc file.

    Can anybody help me for this??

    tnx all

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •