473,320 Members | 1,976 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

C stored Proc problem on AIX

Gurus,

I have a verb big problem which I'm unable to explain.
We have a DB2 V6.1.0 on AIX 4.3
I want to make a C stored procedure which at the end will be called by a PHP
script.
The development server was an UDB V6.1.0 on W2K.
Everything went well. I was able to call the stored proc from C and from
Delphi.

After we have installed the proc on the production machine.
Compiled, linked well after copied to the right place SQLLIB/function

Declared the proc:
CREATE PROCEDURE DB2NC.S_GETPRODUCTLIST
(IN BS_BSREF INTEGER,
IN DATEPARAM DATE
)
DYNAMIC RESULT SETS 1
EXTERNAL NAME 'sbprogs1!S_GetProductList'
LANGUAGE C
PARAMETER STYLE DB2SQL
DETERMINISTIC
FENCED
NO DBINFO
CALLED ON NULL INPUT
PROGRAM TYPE SUB

Here is the C header:
SQL_API_RC SQL_API_FN S_GetProductList(SQLUDF_INTEGER *BS_BSREF,

SQLUDF_CHAR DateParam1[11],

SQLUDF_NULLIND *BS_BSREFNullInd,

SQLUDF_NULLIND *DateParam1NullInd,

SQLUDF_TRAIL_ARGS) ;

From the PHP we have got this error message:
Warning: odbc_execute(): SQL error: [IBM][CLI Driver][DB2/6000] SQL10010N
The specified library, "sbprogs1", was loaded, but the function
"S_GetProductList" could not be executed. , SQL state S1000 in SQLExecute

If after that I call the same proc from a C client prog I have this error
message:
SQLSTATE: HY010
Native Error Code: -99999
[IBM][CLI Driver] CLI0125E Function sequence error. SQLSTATE=HY010
What is wrong?
How can I get the proc running from a C or a PHP code?
What is the difference between the PARAMETER STYLE GENERAL AND DB2SQL?

Thank you for help. I'm really in a big trouble because the SQL code is very
complicated and it could be done only in a stored proc.

Gabor


Nov 12 '05 #1
4 4356
Note that v6 has been out of service for a long time, so you probably
won't get too many suggestions on this...

The second failure looks like a coding problem in your CLI application.

The PHP failure could be a few things...did you declare your function as
'extern C'? If not, the symbol may be getting mangled by the C++
compiler. To check, you can dump the symbols in your library.

Nyul wrote:
Gurus,

I have a verb big problem which I'm unable to explain.
We have a DB2 V6.1.0 on AIX 4.3
I want to make a C stored procedure which at the end will be called by a PHP
script.
The development server was an UDB V6.1.0 on W2K.
Everything went well. I was able to call the stored proc from C and from
Delphi.

After we have installed the proc on the production machine.
Compiled, linked well after copied to the right place SQLLIB/function

Declared the proc:
CREATE PROCEDURE DB2NC.S_GETPRODUCTLIST
(IN BS_BSREF INTEGER,
IN DATEPARAM DATE
)
DYNAMIC RESULT SETS 1
EXTERNAL NAME 'sbprogs1!S_GetProductList'
LANGUAGE C
PARAMETER STYLE DB2SQL
DETERMINISTIC
FENCED
NO DBINFO
CALLED ON NULL INPUT
PROGRAM TYPE SUB

Here is the C header:
SQL_API_RC SQL_API_FN S_GetProductList(SQLUDF_INTEGER *BS_BSREF,

SQLUDF_CHAR DateParam1[11],

SQLUDF_NULLIND *BS_BSREFNullInd,

SQLUDF_NULLIND *DateParam1NullInd,

SQLUDF_TRAIL_ARGS) ;

From the PHP we have got this error message:
Warning: odbc_execute(): SQL error: [IBM][CLI Driver][DB2/6000] SQL10010N
The specified library, "sbprogs1", was loaded, but the function
"S_GetProductList" could not be executed. , SQL state S1000 in SQLExecute

If after that I call the same proc from a C client prog I have this error
message:
SQLSTATE: HY010
Native Error Code: -99999
[IBM][CLI Driver] CLI0125E Function sequence error. SQLSTATE=HY010
What is wrong?
How can I get the proc running from a C or a PHP code?
What is the difference between the PARAMETER STYLE GENERAL AND DB2SQL?

Thank you for help. I'm really in a big trouble because the SQL code is very
complicated and it could be done only in a stored proc.

Gabor

Nov 12 '05 #2
Sean,

Thanks for reply.
coming back to your suggestions:
- I've checked the internet and I've seen that both of the error messages
are appearing on DB2 V7.x too. The problem is that non of thos messages has
been succesfully solved. At least there was no answer on.
- If it would be a coding error why is it running without problem on my W2K
test machine?
- the stored procedure is written in C not in C++ so no extern "C" is
required.

I really suspect a kind of declaration or parameter problem if not a
configureation parameter setting problem.
Do you know if it exists any DBM CFG which doesn't allow stored procedures
to run?

bye

Gabor

"Sean McKeough" <mc******@nospam.ca.ibm.com> az alábbiakat írta a következo
üzenetben news:bu**********@hanover.torolab.ibm.com...
Note that v6 has been out of service for a long time, so you probably
won't get too many suggestions on this...

The second failure looks like a coding problem in your CLI application.

The PHP failure could be a few things...did you declare your function as
'extern C'? If not, the symbol may be getting mangled by the C++
compiler. To check, you can dump the symbols in your library.

Nyul wrote:
Gurus,

I have a verb big problem which I'm unable to explain.
We have a DB2 V6.1.0 on AIX 4.3
I want to make a C stored procedure which at the end will be called by a PHP script.
The development server was an UDB V6.1.0 on W2K.
Everything went well. I was able to call the stored proc from C and from
Delphi.

After we have installed the proc on the production machine.
Compiled, linked well after copied to the right place SQLLIB/function

Declared the proc:
CREATE PROCEDURE DB2NC.S_GETPRODUCTLIST
(IN BS_BSREF INTEGER,
IN DATEPARAM DATE
)
DYNAMIC RESULT SETS 1
EXTERNAL NAME 'sbprogs1!S_GetProductList'
LANGUAGE C
PARAMETER STYLE DB2SQL
DETERMINISTIC
FENCED
NO DBINFO
CALLED ON NULL INPUT
PROGRAM TYPE SUB

Here is the C header:
SQL_API_RC SQL_API_FN S_GetProductList(SQLUDF_INTEGER *BS_BSREF,

SQLUDF_CHAR DateParam1[11],

SQLUDF_NULLIND *BS_BSREFNullInd,

SQLUDF_NULLIND *DateParam1NullInd,

SQLUDF_TRAIL_ARGS) ;

From the PHP we have got this error message:
Warning: odbc_execute(): SQL error: [IBM][CLI Driver][DB2/6000] SQL10010N The specified library, "sbprogs1", was loaded, but the function
"S_GetProductList" could not be executed. , SQL state S1000 in SQLExecute
If after that I call the same proc from a C client prog I have this error message:
SQLSTATE: HY010
Native Error Code: -99999
[IBM][CLI Driver] CLI0125E Function sequence error. SQLSTATE=HY010
What is wrong?
How can I get the proc running from a C or a PHP code?
What is the difference between the PARAMETER STYLE GENERAL AND DB2SQL?

Thank you for help. I'm really in a big trouble because the SQL code is very complicated and it could be done only in a stored proc.

Gabor

Nov 12 '05 #3
Nyul <ny***@largon.hu> wrote:
- the stored procedure is written in C not in C++ so no extern "C" is
required.


The question is here which compiler you used. Nearly all C code is also
valid C++ code. And if you use a C++ compiler, you can get C++ name
mangling.

--
Knut Stolze
Information Integration
IBM Germany / University of Jena
Nov 12 '05 #4
"Nyul" <ny***@largon.hu> wrote in message news:<qF*********************@news.chello.at>...

<snip>
We have a DB2 V6.1.0 on AIX 4.3
The development server was an UDB V6.1.0 on W2K. Warning: odbc_execute(): SQL error: [IBM][CLI Driver][DB2/6000] SQL10010N
The specified library, "sbprogs1", was loaded, but the function
"S_GetProductList" could not be executed. , SQL state S1000 in SQLExecute


<snip>
You say it Works OK in Windows , but fails on AIX 4.3.

What were the command-line options/switches that you gave
to the "ld" program (or "cc" ) on AIX ?

Did you verify that the executable really contains an
exported symbol identical to what you expect ?
(On AIX, Use commands "dump" (with options) and "nm" (with options)
to help in this area).

If you cannot get it to work with *your* stored procedure
on AIX, then verify that you can get the IBM supplied sample
stored procedures to work on AIX (with the sample database).

If you still cannot proceed, use DIAGLEVEL 4, and retry, then
check the most recent messages in db2diag.log to see if it
gives any more details. But in my opinion it seems likely
to be a build problem.

Good luck.
Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: June Moore | last post by:
Hi all, I have a stored procedure that return a resultset e.g. stored proc: get_employee_details select emp_id, emp_name, emp_salary, emp_position from empoloyee I would like to write...
9
by: Wolfgang Kreuzer | last post by:
Try hard to become familiar with T-SQL. Can anybodey tell me the best way to deal with set's provided by a stored procedure. Til yesterday I thougt trapping set in temp table using INSERT EXEC...
0
by: Dave Sisk | last post by:
I've created a system or external trigger on an AS/400 file a.k.a DB2 table. (Note this is an external trigger defined with the ADDPFTRG CL command, not a SQL trigger defined with the CREATE...
5
by: Rhino | last post by:
This question relates to DB2 Version 6 on OS/390. Can a (COBOL) stored procedure on this platform do file I/O, i.e. write to a sequential file? I am trying to debug a stored procedure. As far...
2
by: Rhino | last post by:
I am getting an sqlcode of -927 when I execute SQL within a COBOL stored procedure in DB2 OS/390 Version 6 on OS/390. I have looked at the error message for that condition and tried everything I...
1
by: mike | last post by:
If I try and do a "SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1" after I have run a stored procedure in DB2 version 7.2, I get the last generated Key before the CallableStatement was executed...
14
by: Roy | last post by:
Apologies for the cross-post, but this truly is a two-sided question. Given the option of creating Looping statements within a stored proc of sql server or in the code-behind of an .net webpage,...
0
by: balaji krishna | last post by:
Hi, I need to handle the return set from COBOL stored procedure from my invoking Java program. I do not know, how many rows the stored proc SQL fetches.I have declared the cursor in that proc, but i...
0
by: mirandacascade | last post by:
Questions toward the bottom of the post. Situation is this: 1) Access 97 2) SQL Server 2000 3) The Access app: a) sets up pass-thru query b) .SQL property of querydef is a string, the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shćllîpôpď 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.