vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi all! I want to insert the record into the table by using an application program that includes the following statements: EXEC SQL BEGIN DECLARE SECTION; long hvInt_Stor; long hvExt_Stor; EXEC SQL END DECLARE SECTION; hvInt_Stor = MMDB_STORAGE_TYPE_INTERNAL; hvExt_Stor = MMDB_STORAGE_TYPE_EXTERNAL; EXEC SQL INSERT INTO EMPLOYEE VALUES( '128557', /*id*/ 'Anita Jones', /*name*/ DB2IMAGE( /*Image Extender UDF*/ CURRENT SERVER, /*database server name in*/ /CURRENT SERVER register*/ '/employee/images/ajones.bmp' /*image source file*/ 'ASIS', /*keep the image format*/ :hvInt_Stor, /*store image in DB as BLOB*/ 'Anita''s picture'), /*comment*/ DB2AUDIO( /*Audio Extender UDF*/ CURRENT SERVER, /*database server name in*/ /*CURRENT SERVER register*/ '/employee/sounds/ajones.wav', /*audio source file*/ 'WAVE', /* audio format */ :hvExt_Stor, /*retain content in server file*/ 'Anita''s voice') /*comment*/ ); Maybe that's silly question,but : what compiler should I use? and which libraries should I include? I toil over this for 2 weeks... I'm using Microsoft Visual C++ at this moment( Borland C 5.5 compiler before),but I can't compile this programme without errors (commonly errors are inside library: sqltypes.h) 1. How to force this compiler to use IBM libaries only when it is possible? 2. Maybe someone could tell me how to write programme,that include statements that were shown above?? I'm close to break down :-( Vavel |
| |||
| "Vavel" <change@any.fm> wrote in message news:ctnpun$jud$1@inews.gazeta.pl... > Hi all! > I want to insert the record into the table by > using an application program that includes the following statements: > > EXEC SQL BEGIN DECLARE SECTION; > long hvInt_Stor; > long hvExt_Stor; > EXEC SQL END DECLARE SECTION; > hvInt_Stor = MMDB_STORAGE_TYPE_INTERNAL; > hvExt_Stor = MMDB_STORAGE_TYPE_EXTERNAL; > EXEC SQL INSERT INTO EMPLOYEE VALUES( > '128557', /*id*/ > 'Anita Jones', /*name*/ > DB2IMAGE( /*Image Extender UDF*/ > CURRENT SERVER, /*database server name in*/ > /CURRENT SERVER register*/ > '/employee/images/ajones.bmp' /*image source file*/ > 'ASIS', /*keep the image format*/ > :hvInt_Stor, /*store image in DB as BLOB*/ > 'Anita''s picture'), /*comment*/ > DB2AUDIO( /*Audio Extender UDF*/ > CURRENT SERVER, /*database server name in*/ > /*CURRENT SERVER register*/ > '/employee/sounds/ajones.wav', /*audio source file*/ > 'WAVE', /* audio format */ > :hvExt_Stor, /*retain content in server file*/ > 'Anita''s voice') /*comment*/ > ); > > Maybe that's silly question,but : what compiler should I use? and which > libraries should I include? I toil over this for 2 weeks... I'm using > Microsoft Visual C++ at this moment( Borland C 5.5 compiler before),but > I can't compile this programme without errors (commonly errors are > inside library: sqltypes.h) > 1. How to force this compiler to use IBM libaries only when it is possible? > 2. Maybe someone could tell me how to write programme,that include > statements that were shown above?? > > I'm close to break down :-( > Have you given any thought to looking at the Application Programming/Building manuals that come with your copy of DB2? These manuals describe the process of compiling your programs and describe which compilers have been tested with DB2. They also give many examples of programs in a variety of languages that you can imitate. I have to assume you didn't look at any of these examples because you appear to have a large number of comments interspersed throughout your Insert statement. If you remove those comments, I expect you'll have much better luck with your compile. Rhino |
| |||
| Rhino wrote: > Have you given any thought to looking at the Application > Programming/Building manuals that come with your copy of DB2? These manuals > describe the process of compiling your programs and describe which compilers > have been tested with DB2. They also give many examples of programs in a > variety of languages that you can imitate. > 1.Application Development Guide:Building and Running Applications 2.Quick Beginnings for DB2 Clients 3. DB2 UDB Exploitation of the Windows Environment I know that if someone asked about something first answer in many times is RTFM. But I've looked at manuals that I've listed above, but I didn't find answer. I don't say that there is no answer in this manuals but I can't find it.That's why I asked for help. > I have to assume you didn't look at any of these examples because you appear > to have a large number of comments interspersed throughout your Insert > statement. If you remove those comments, I expect you'll have much better > luck with your compile. But my compiler didn't look at my statement at all because there was an errors in libaries,while statements were compiled. Maybe someone have seen example that would help me. It's easy to say: "everything is in manual"... greetings Vavel |
| |||
| Vavel wrote: > Rhino wrote: > >> Have you given any thought to looking at the Application >> Programming/Building manuals that come with your copy of DB2? These >> manuals >> describe the process of compiling your programs and describe which >> compilers >> have been tested with DB2. They also give many examples of programs in a >> variety of languages that you can imitate. >> > 1.Application Development Guide:Building and Running Applications > 2.Quick Beginnings for DB2 Clients > 3. DB2 UDB Exploitation of the Windows Environment > > I know that if someone asked about something first answer in many times > is RTFM. But I've looked at manuals that I've listed above, but I > didn't find answer. I don't say that there is no answer in this manuals > but I can't find it.That's why I asked for help. > >> I have to assume you didn't look at any of these examples because you >> appear >> to have a large number of comments interspersed throughout your Insert >> statement. If you remove those comments, I expect you'll have much better >> luck with your compile. > > But my compiler didn't look at my statement at all because there was an > errors in libaries,while statements were compiled. Maybe someone have > seen example that would help me. It's easy to say: "everything is in > manual"... The code looks like Embedded SQL in C - in Informix terms, ESQL/C. You need to find the correct preprocessor that will convert that into a C source file, and then compile that C source with the correct headers (and libraries) into an object or executable. -- Jonathan Leffler #include <disclaimer.h> Email: jleffler@earthlink.net, jleffler@us.ibm.com Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/ |
| |||
| Vavel wrote: > Hi all! > I want to insert the record into the table by > using an application program that includes the following statements: > > EXEC SQL BEGIN DECLARE SECTION; > long hvInt_Stor; > long hvExt_Stor; > EXEC SQL END DECLARE SECTION; > hvInt_Stor = MMDB_STORAGE_TYPE_INTERNAL; > hvExt_Stor = MMDB_STORAGE_TYPE_EXTERNAL; > EXEC SQL INSERT INTO EMPLOYEE VALUES( > '128557', /*id*/ > 'Anita Jones', /*name*/ > DB2IMAGE( /*Image Extender UDF*/ > CURRENT SERVER, /*database server name in*/ > /CURRENT SERVER register*/ > '/employee/images/ajones.bmp' /*image source file*/ > 'ASIS', /*keep the image format*/ > :hvInt_Stor, /*store image in DB as BLOB*/ > 'Anita''s picture'), /*comment*/ > DB2AUDIO( /*Audio Extender UDF*/ > CURRENT SERVER, /*database server name in*/ > /*CURRENT SERVER register*/ > '/employee/sounds/ajones.wav', /*audio source file*/ > 'WAVE', /* audio format */ > :hvExt_Stor, /*retain content in server file*/ > 'Anita''s voice') /*comment*/ > ); > > Maybe that's silly question,but : what compiler should I use? and which > libraries should I include? I toil over this for 2 weeks... I'm using > Microsoft Visual C++ at this moment( Borland C 5.5 compiler before),but > I can't compile this programme without errors (commonly errors are > inside library: sqltypes.h) > 1. How to force this compiler to use IBM libaries only when it is > possible? 2. Maybe someone could tell me how to write programme,that > include statements that were shown above?? You are probably aware of this, but everything following the "EXEC SQL" keywords is not valid C or C++ code. So the compiler should actually raise some syntax errors. You need to precompile the code to translate the "EXEC SQL" things into real C function calls. Have a look at the db2 precompiler (http://publib.boulder.ibm.com/infoce...e/r0001964.htm) for that. Once you compiled the code you can link it into a library or executable. In this step, you need to link in the library libdb2.a (exact name and extension depends on you platform). Additionally, you might need libdb2api and/or libdb2apie. I don't recall if you need an additional library for the AIV Extender, but I don't think so. -- Knut Stolze Information Integration IBM Germany / University of Jena |
| |||
| Knut Stolze wrote: > You are probably aware of this, but everything following the "EXEC SQL" > keywords is not valid C or C++ code. So the compiler should actually raise > some syntax errors. You need to precompile the code to translate the "EXEC > SQL" things into real C function calls. Have a look at the db2 precompiler > (http://publib.boulder.ibm.com/infoce...e/r0001964.htm) > for that. > > Once you compiled the code you can link it into a library or executable. In > this step, you need to link in the library libdb2.a (exact name and > extension depends on you platform). Additionally, you might need libdb2api > and/or libdb2apie. I don't recall if you need an additional library for > the AIV Extender, but I don't think so. > Hi You gave me strongly useful informations. I've read about precompiler already.Thank you! I've already added to my database audio and image data (as yet only manually, because I have got one error: C:\PROGRA~1\IBM\DMB\include\dmbsystm.h:280: #error "DMB: Unsupported Operating System" (dmbaudio.h, dmbvideo.h and dmbimage.h call to dmbbase.h and this library calls to dmbsystm.h) dmbsystm.h: /* dmbsystm.h */ /* This header file is included at the beginning of all DMB header files to define the portibility linkage/export macros for the header file prototypes. */ .... /************************************************** ****************************/ /* Macros based on a specific operating system. */ /************************************************** ****************************/ /*-----------------------------------------------------------------AIX--------*/ #if defined(DMB_UNIX) #define DMB_PATH_SEP '/' #define MaxPathName 1000 /*-----------------------------------------------------------------OS/2-------*/ #elif defined(DMB_OS2) #define DMB_PATH_SEP '\\' #define MaxPathName 260 /*---------------------------------------------------------------Windows 3.1--*/ #elif defined(DMB_WINDOWS) #define DMB_PATH_SEP '\\' #define MaxPathName 1000 /*-----------------------------------------------------------------MacOs------*/ #elif defined(DMB_MAC) #define DMB_PATH_SEP ':' #define MaxPathName 1000 /*-----------------------------------------------------------------Unknown----*/ #else #ifndef __MWERKS__ /* !!!!!!!!!!!!! line 280: */ #error "DMB: Unsupported Operating System" #endif #endif /* EOF */ My OS is Win XP Service Pack 2 IBM DB2 UDB v8.1.3 Personnal Edition for Win May I manually set DMB_WINDOWS? Vavel |
| |||
| when I precompile file gc1.sqc ( error: SQL0440N ...didn't find procedure called "DB2IMAGE"... SQLSTATE=42884 SQL0092N No package was created because of previous errors ) but file gc1.c was created. So I compile this file using Dev-C++ and there is one error: In file included from C:\PROGRA~1\IBM\DMB\include\dmbbase.h:64, from dmbaudio.h:19, from gc1.sqc:4: C:\PROGRA~1\IBM\DMB\include\dmbsystm.h:280: #error "DMB: Unsupported Operating System" fragment of dmbbase.h: #if defined(DB2AIX) #if !defined(DMB_AIX) #define DMB_AIX #define DMB_UNIX #endif #elif defined(DB2MVS) #if !defined(DMB_MVS) #define DMB_MVS #endif #elif defined(DB2OS2) #if !defined(DMB_OS2) #define DMB_OS2 #endif #elif defined(DB2_MAC) #if !defined(DMB_MAC) #define DMB_MAC #endif #elif defined(DB2W95) #if !defined(DMB_W95) #define DMB_W95 #endif #elif defined(DB2NT) #if !defined(DMB_WNT) && !defined(DMB_W95) #define DMB_WNT #endif #elif defined(DB2WIN) #if !defined(DMB_WIN) #define DMB_WIN #endif #elif defined(DB2HP) #if !defined(DMB_HP) #define DMB_HP #define DMB_UNIX #endif #elif defined(DB2SUN) #if !defined(DMB_SUN) #define DMB_SUN #define DMB_UNIX #endif #elif defined(DB2PTX) #define DMB_SEQ #define DMB_UNIX #else /* line 64: */ #error "DMB: Unsupported Operating System" #endif maybe should I set one variable? Vavel |
| |||
| Vavel wrote: > Knut Stolze wrote: > >> You are probably aware of this, but everything following the "EXEC SQL" >> keywords is not valid C or C++ code. So the compiler should actually >> raise >> some syntax errors. You need to precompile the code to translate the >> "EXEC >> SQL" things into real C function calls. Have a look at the db2 >> precompiler >> (http://publib.boulder.ibm.com/infoce...e/r0001964.htm) >> for that. >> >> Once you compiled the code you can link it into a library or executable. >> In this step, you need to link in the library libdb2.a (exact name and >> extension depends on you platform). Additionally, you might need >> libdb2api >> and/or libdb2apie. I don't recall if you need an additional library for >> the AIV Extender, but I don't think so. > > Hi > You gave me strongly useful informations. I've read about precompiler > already.Thank you! > I've already added to my database audio and image data (as yet only > manually, because I have got one error: > > C:\PROGRA~1\IBM\DMB\include\dmbsystm.h:280: #error "DMB: Unsupported > Operating System" > (dmbaudio.h, dmbvideo.h and dmbimage.h call to dmbbase.h and this > library calls to dmbsystm.h) A *.h file is a header file that just contains some declarations of functions that are provided by some library - it is not the library itself. Please don't mix those two different things. > dmbsystm.h: > /* dmbsystm.h */ > /* This header file is included at the beginning of all DMB header > files to define the portibility linkage/export macros for the header > file prototypes. */ > ... > /************************************************** ****************************/ > /* Macros based on a specific operating system. */ > /************************************************** ****************************/ > /*-----------------------------------------------------------------AIX--------*/ > #if defined(DMB_UNIX) > #define DMB_PATH_SEP '/' > #define MaxPathName 1000 > /*-----------------------------------------------------------------OS/2-------*/ > #elif defined(DMB_OS2) > #define DMB_PATH_SEP '\\' > #define MaxPathName 260 > /*---------------------------------------------------------------Windows > 3.1--*/ > #elif defined(DMB_WINDOWS) > #define DMB_PATH_SEP '\\' > #define MaxPathName 1000 > /*-----------------------------------------------------------------MacOs------*/ > #elif defined(DMB_MAC) > > #define DMB_PATH_SEP ':' > #define MaxPathName 1000 > > /*-----------------------------------------------------------------Unknown----*/ > #else > #ifndef __MWERKS__ > /* !!!!!!!!!!!!! line 280: */ > #error "DMB: Unsupported Operating System" > #endif > #endif > /* EOF */ > > My OS is Win XP Service Pack 2 > IBM DB2 UDB v8.1.3 Personnal Edition for Win > > May I manually set DMB_WINDOWS? That's one option. However, I think you did not include the DB2 header files, specifically sqlsystm.h, before you included the dmb*.h header file (dmbimage.h, I guess). So I'd recommend this: #include "sql.h" #include "dmbimage.h" -- Knut Stolze Information Integration IBM Germany / University of Jena |
| |||
| Vavel wrote: > when I precompile file gc1.sqc > ( error: SQL0440N ...didn't find procedure called "DB2IMAGE"... > SQLSTATE=42884 > SQL0092N No package was created because of previous errors > ) Either you call a not existing function (problem with the parameters or whatever), or you did not enable your database against which you compile the code for the Image Extender. The exact error message would be interesting, along with exact code and all the relevant information from the db2diag.log. Additionally, the steps you have taken so far to prepare your database would be helpful to know. -- Knut Stolze Information Integration IBM Germany / University of Jena |
| ||||
| Knut Stolze wrote: > Vavel wrote: > > >>when I precompile file gc1.sqc >>( error: SQL0440N ...didn't find procedure called "DB2IMAGE"... >>SQLSTATE=42884 >>SQL0092N No package was created because of previous errors >>) > > > Either you call a not existing function (problem with the parameters or > whatever), or you did not enable your database against which you compile > the code for the Image Extender. The exact error message would be > interesting, along with exact code and all the relevant information from > the db2diag.log. Additionally, the steps you have taken so far to prepare > your database would be helpful to know. > error: SQL0440N No procedure by the name "DB2IMAGE" and type "FUNCTION" having compatible arguments was found. SQLSTATE=42884 (I've translated this message, because I've db2 in my native language) SQL0092N No package was created because of previous errors SQL0091W Precompilation or binding was ended with "2" errors and "0" warnings /*************************grzes2.sqc*************** ********************/ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "dmbaudio.h" /* audio extender function prototypes (DBa) */ #include "dmbimage.h" /* image extender function prototypes (DBi) */ #include "dmbvideo.h" /* video extender function prototypes (DBv) */ #include "utility.h" /* utility functions */ int main(int argc, char *argv[]) { EXEC SQL BEGIN DECLARE SECTION; long hvInt_Stor; long hvExt_Stor; EXEC SQL END DECLARE SECTION; hvInt_Stor = MMDB_STORAGE_TYPE_INTERNAL; hvExt_Stor = MMDB_STORAGE_TYPE_EXTERNAL; EXEC SQL INSERT INTO EMPLOYEE VALUES( '128557', 'Anita Jones', DB2IMAGE( CURRENT SERVER, 'd:\personn\employee\images\ajones.bmp', 'BMP', /*:hvInt_Stor,*/ 1, 'Anita''s picture'), DB2AUDIO( CURRENT SERVER, 'd:\personn\employee\sounds\ajones.wav', 'WAVE', /*:hvExt_Stor,*/ 1, 'Anita''s voice') ); return 0; } /****************end of grzes2.sqc********************************/ when I manually type in db2 command line processor: INSERT INTO EMPLOYEE VALUES('128557','Anita Jones', DB2IMAGE(CURRENT SERVER,'d:\personn\employee\images\ajones.bmp', 'BMP',1,'Anita''s picture'), DB2AUDIO(CURRENT SERVER,'d:\personn\employee\sounds\ajones.wav', 'WAVE',1,'Anita''s voice')) DB20000I The SQL command completed successfully. Adding #include "sql.h" before dmb*.h header files doesn't resolve problem. I think that header files are proper, because I've found on IBM an example file that Import data into a table enabled for audio, image and video extenders and it starts with the same header files as me. /***************db2diag.log:*********************** ******/ 2005-02-02-20.39.18.593000 Instance PID:3252(db2syscs.exe) TID:3268 Appid:none base sys utilities startdbm Probe:911 ADM7513W Database manager has started. 2005-02-02-20.39.23.921000 Instance PID:3088(db2bp.exe) TID:3084 Appid:none base sys utilities sqleatin Probe:1 DIA8515C A system error has occurred. ZRC=0x87340014 2005-02-02-20.44.20.093000 Instance PID:552(db2syscs.exe) TID:608 Appid:none base sys utilities startdbm Probe:911 ADM7513W Database manager has started. 2005-02-02-20.47.22.562000 Instance PID:552(db2syscs.exe) TID:3512 Appid:*LOCAL.DB2.01B5C2194715 data management sqldEscalateLocks Probe:3 Database:PERSONN1 ADM5502W The escalation of "315" locks on table "SYSIBM ..SYSROUTINEPARMS" to lock intent "X" was successful. 2005-02-02-20.47.22.562001 Instance PID:552(db2syscs.exe) TID:3512 Appid:*LOCAL.DB2.01B5C2194715 data management sqldEscalateLocks Probe:3 Database:PERSONN1 ADM5502W The escalation of "80" locks on table "SYSIBM ..SYSROUTINEAUTH" to lock intent "X" was successful. 2005-02-02-21.02.00.906000 Instance PID:3484(db2fmp.exe) TID:3488 Appid:none routine_infrastructure sqlerRoutineResolveAddress Probe:10 DIA1002C Error accessing function "" in library "". ZRC=0x870F0038 2005-02-03-11.43.31.421000 Instance PID:628(db2syscs.exe) TID:644 Appid:none base sys utilities startdbm Probe:911 ADM7513W Database manager has started. /*******************end of db2diag.log******************************/ > Additionally, the steps you have taken so far to prepare > your database would be helpful to know. > 1.The system administrator uses the db2ext command-line processor: CONNECT TO personnl ENABLE DATABASE FOR DB2IMAGE 2.DBA adds the mmdbsys schema in the current function path: SET CURRENT FUNCTION PATH = mmdbsys, CURRENT FUNCTION PATH 3. DBA then uses the db2ext command-line processor: ENABLE TABLE employee FOR DB2IMAGE ENABLE COLUMN employee picture FOR DB2IMAGE 4.ENABLE DATABASE FOR DB2AUDIO 5.ENABLE TABLE employee FOR DB2AUDIO ENABLE COLUMN employee voice FOR DB2AUDIO And there is one more thing. When I compile populate.c (that Import data into a table enabled for audio, image and video extenders) there is the same error: In file included from C:\PROGRA~1\IBM\DMB\include\dmbbase.h:64, from C:\PROGRA~1\IBM\DMB\include\dmbaudio.h:19, from c:\progra~1\ibm\dmb\samples\populate.c:41: C:\PROGRA~1\IBM\DMB\include\dmbsystm.h:280: #error "DMB: Unsupported Operating System" So I think it's not error in my programme. Vavel |
| Thread Tools | |
| Display Modes | |
|
|