Unix Technical Forum

SQL stored procedure on UDB 8.1.3 ....

This is a discussion on SQL stored procedure on UDB 8.1.3 .... within the DB2 forums, part of the Database Server Software category; --> This is the first simple SQL PL stored procedure that I tried on UDB (UDB PE on XP): CREATE ...


Go Back   Unix Technical Forum > Database Server Software > DB2

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-26-2008, 07:56 PM
Raquel
 
Posts: n/a
Default SQL stored procedure on UDB 8.1.3 ....

This is the first simple SQL PL stored procedure that I tried on UDB
(UDB
PE on XP):

CREATE PROCEDURE SQLSP1
( IN PEMPNO CHAR(6)
, IN PRAISEPCT DEC(6,2)
)
LANGUAGE SQL
UPDATE DB2ADMIN.EMPLOYEE
SET SALARY = SALARY * (1 + PRAISEPCT/100)
WHERE EMPNO = PEMPNO;

While executing this statement, it fails:

SQL1131N DARI (Stored Procedure) process has been terminated
abnormally.

Explanation:

The cause of this error may be:

o There was a coding error (e.g. segmentation violation) within the
DARI routine.
o The DARI process has been terminated by another process through
the
use of a signal.

User Response:

Reinitiate the DARI request after doing the following :

o Ensure that the DARI procedure is free from programming errors.

o Make sure that no user is sending a termination signal to the DARI
process.

sqlcode : -1131
sqlstate : 38503

Wondering that it had something to do with C compiler not being
properly installed on my machine, I scanned the web, downloaded
"Miracle C" compiler on the PC and then set DB2_SQLROUTINE_COMPILER
registry variable to point to the compiler...didn't help.

TIA.
Raquel.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-26-2008, 07:57 PM
Serge Rielau
 
Posts: n/a
Default Re: SQL stored procedure on UDB 8.1.3 ....

Miracle C? This compiler is not supported. Ideally you should use the
Microsoft compiler, but if you want a free compiler I would recommend
gcc. It has been used successfully on Windows fro SQL Procedures.
I think there is also an article on developerWorks/DB2

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-26-2008, 07:57 PM
Gert van der Kooij
 
Posts: n/a
Default Re: SQL stored procedure on UDB 8.1.3 ....

In article <cd8g6k$ck$2@hanover.torolab.ibm.com>, Serge Rielau
(srielau@ca.eye-be-em.com) says...
> Miracle C? This compiler is not supported. Ideally you should use the
> Microsoft compiler, but if you want a free compiler I would recommend
> gcc. It has been used successfully on Windows fro SQL Procedures.
> I think there is also an article on developerWorks/DB2
>
> Cheers
> Serge
>
>


Is this free Visual C++ compiler from Microsoft supported?

http://msdn.microsoft.com/visualc/vctoolkit2003/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-26-2008, 07:58 PM
Raquel
 
Posts: n/a
Default Re: SQL stored procedure on UDB 8.1.3 ....

Serge Rielau <srielau@ca.eye-be-em.com> wrote in message news:<cd8g6k$ck$2@hanover.torolab.ibm.com>...
> Miracle C? This compiler is not supported. Ideally you should use the
> Microsoft compiler, but if you want a free compiler I would recommend
> gcc. It has been used successfully on Windows fro SQL Procedures.
> I think there is also an article on developerWorks/DB2
>
> Cheers
> Serge


ok, am drawing a blank here. I downloaded the gcc compiler and
configured the environment according to the article
http://www-106.ibm.com/developerwork...306haungs.html

But still facing the same error message: SQL1131N (DARI process has
been terminated abnormally).

BTW, I am at PE V8.1.3 on XP while this article seems to be written
for V7. Has something changed vis a vis SQL Stored procedure build?

These are the error messages generated in tmp file:

LINE MESSAGES FOR P7171799.sqc
------ --------------------------------------------------------------------
SQL0060W The "C" precompiler is in progress.
SQL1024N A database connection does not exist.
SQLSTATE=08003
SQL0095N No bind file was created because of previous
errors.
SQL0092N No package was created because of previous
errors.
SQL0091W Precompilation or binding was ended with "3"
errors and "0" warnings.

I am absolutely sure that the Database connection exists (am doing it
through CLP and subsequently executing "db2 -td! -v -fsample.clp"
command.)

DB2PATH has been set as environment variable with value
"D:\PROGRA~1\IBM\SQLLIB"

db2 registry variable DB2_SQLROUTINE_COMPILE_COMMAND has been set to
"D:\bin\db2gcc.bat SQLROUTINE_FILENAME"

db2gcc.bat (which I created in D:\bin) looks like this (per the
recommendation in above article):

setlocal
set CYGWIN=D:\cygwin
gcc -c -g -mno-cygwin -I%DB2PATH%\include -I%CYGWIN%\usr\include %1.c
-o %1.o
sed -e s/\_// %1.def > %1_m.def
dllwrap -mno-cygwin -target i386-mingw32 -o %1.dll %1.o
%DB2PATH%\lib\db2api.lib --def %1_m.def


D:\cygwin has all the downloaded 'stuff' (bin, usr, lib etc.) for the
GCC compiler.

db2diag.log, among a host of other messages has the following messages
(dunno what they mean):
DIA0001E An internal error occurred. Report the following error code :
"ZRC=0x8012006D".
DIA0001E An internal error occurred. Report the following error code :
"ZRC=0x80370086".
DIA0001E An internal error occurred. Report the following error code :
"ZRC=0x80120086".

Any pointers would be appreciated.

TIA
Raquel.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-26-2008, 07:58 PM
Raquel
 
Posts: n/a
Default Re: SQL stored procedure on UDB 8.1.3 ....

Any ideas anyone..this is kinda getting frustrating..another
surprising thing I noticed was that even when there is no C/C++
compiler installed on my machine, there is a .sqc code generated from
the procedure which looks like C code to me. What is this code?

Raquel.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-26-2008, 07:58 PM
Raquel
 
Posts: n/a
Default Re: SQL stored procedure on UDB 8.1.3 ....

Any ideas anyone..this is kinda getting frustrating..another
surprising thing I noticed was that even when there is no C/C++
compiler installed on my machine, there is a .sqc code generated from
the procedure which looks like C code to me. What is this code?

Raquel.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-26-2008, 07:59 PM
Knut Stolze
 
Posts: n/a
Default Re: SQL stored procedure on UDB 8.1.3 ....

Raquel wrote:

> Any ideas anyone..this is kinda getting frustrating..another
> surprising thing I noticed was that even when there is no C/C++
> compiler installed on my machine, there is a .sqc code generated from
> the procedure which looks like C code to me. What is this code?


..sqc files are files that contain C code with embedded SQL statements. The
embedded SQL is denoted with the EXEC SQL keywords, and it must first be
pre-processed by the DB2 precompiler. The DB2 precompiler will translate
the SQL statements to normal C function call and, thus, give you valid C
code.

--
Knut Stolze
Information Integration
IBM Germany / University of Jena
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:03 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com