Hi Everyone,
I am learning how to write C++ programs for DB2. My primary area of
concern would be the administrative level DB2 APIs.
For the time being, I am also looking at how to create packages and
bindfiles for DB2. I have the below mentioned code which is giving me
the following error:
############### ############### ##########
#include <string.h>
#include <sqlenv.h>
#include <sqlutil.h>
#include "utilemb.h"
#include <iomanip>
#include <iostream>
using namespace std;
int main()
{
EXEC SQL BEGIN DECLARE SECTION;
char PID[11];
sqlint32 quantity;
char location[128];
EXEC SQL END DECLARE SECTION;
cout << "Hopefully this will also work!!" << endl ;
EXEC SQL CONNECT TO SAMPLE ;
EXEC SQL CONNECT RESET ;
return 0 ;
}
############### ############### ##########
ERROR:
[db2inst1@meridi us embed]$ g++ sample2.C -I$DB2PATH/include
sample2.sqC: In function `int main()':
sample2.sqC:23: error: expected primary-expression before ')' token
sample2.sqC:25: error: expected primary-expression before ')' token
[db2inst1@meridi us embed]$
I have copied utilemb.h to $DB2PATH/include directory.
Environment:
DB2 9.1 Fixpak 2
Linux 2.6
CentOS 4.4
GCC/G++ -->
Reading specs from /usr/lib/gcc/x86_64-redhat-linux/3.4.6/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --
infodir=/usr/share/info --enable-shared --enable-threads=posix --
disable-checking --with-system-zlib --enable-__cxa_atexit --disable-
libunwind-exceptions --enable-java-awt=gtk --host=x86_64-redhat-linux
Thread model: posix
gcc version 3.4.6 20060404 (Red Hat 3.4.6-3)
I have noticed that if I remove the following lines from the code, it
compiles successfully:
EXEC SQL CONNECT TO SAMPLE ;
EXEC SQL CONNECT RESET ;
I am only creating the database connection and disconnecting from it.
Can you shed some light as to what am I missing here?
Thanks!!.
dotyet
I am learning how to write C++ programs for DB2. My primary area of
concern would be the administrative level DB2 APIs.
For the time being, I am also looking at how to create packages and
bindfiles for DB2. I have the below mentioned code which is giving me
the following error:
############### ############### ##########
#include <string.h>
#include <sqlenv.h>
#include <sqlutil.h>
#include "utilemb.h"
#include <iomanip>
#include <iostream>
using namespace std;
int main()
{
EXEC SQL BEGIN DECLARE SECTION;
char PID[11];
sqlint32 quantity;
char location[128];
EXEC SQL END DECLARE SECTION;
cout << "Hopefully this will also work!!" << endl ;
EXEC SQL CONNECT TO SAMPLE ;
EXEC SQL CONNECT RESET ;
return 0 ;
}
############### ############### ##########
ERROR:
[db2inst1@meridi us embed]$ g++ sample2.C -I$DB2PATH/include
sample2.sqC: In function `int main()':
sample2.sqC:23: error: expected primary-expression before ')' token
sample2.sqC:25: error: expected primary-expression before ')' token
[db2inst1@meridi us embed]$
I have copied utilemb.h to $DB2PATH/include directory.
Environment:
DB2 9.1 Fixpak 2
Linux 2.6
CentOS 4.4
GCC/G++ -->
Reading specs from /usr/lib/gcc/x86_64-redhat-linux/3.4.6/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --
infodir=/usr/share/info --enable-shared --enable-threads=posix --
disable-checking --with-system-zlib --enable-__cxa_atexit --disable-
libunwind-exceptions --enable-java-awt=gtk --host=x86_64-redhat-linux
Thread model: posix
gcc version 3.4.6 20060404 (Red Hat 3.4.6-3)
I have noticed that if I remove the following lines from the code, it
compiles successfully:
EXEC SQL CONNECT TO SAMPLE ;
EXEC SQL CONNECT RESET ;
I am only creating the database connection and disconnecting from it.
Can you shed some light as to what am I missing here?
Thanks!!.
dotyet
Comment