[Q] ESQL/C - Large Array ?
Posted in 1999
Topics: Error Codes & Troubleshooting, Connectivity: ESQL/C, 4GL & Embedded SQL
Do you know how large array I can use in Informix ESQL/C ?
Look into my attaching test program.
When I declare some large array as "int MyBigArray[2048][1024];" ,
I can't CONNECT to DB.
$ esql myArrayTest.ec
$ a.out
Error -25588: The appl process cannot connect to Dynamic server dbserver1.
<-- Error Messages.
But I comment out the declare statement as /* int MyBigArray[2048][1024];"
*/,
DB CONNECT is OK!
Are there any ESQL/C compile options?
Or where can I find Informix parameters ?
I want to use large array[es] in Informix ESQL/C.
Please help me.
Thanks.
/* ===== Begin of my Big Array Test ===== */
EXEC SQL include sqlca;
int MyBigArray[2048][1024]; /* my Big Array */
main()
{
char errmsg[400];
EXEC SQL connect to 'tidb';
if(SQLCODE != 0)
{
rgetmsg((short)SQLCODE, errmsg, sizeof(errmsg));
printf("\\nError %d: ",SQLCODE);
printf(errmsg, sqlca.sqlerrm);
}
else {
printf("DB Connect OK!\\n");
}
EXEC SQL disconnect current;
}
/* ====== End of my Test ===== */
--- ymji@thinkwaresys.com
The problem is that the array is running into the communications area
needed by the Informix library and forcing shared memory to attach at a
higher address messing up the addressing in the shared areas. If you
change the declaration to an array of pointers to int or array of pointers
to pointers to int and allocate the space using malloc you will not have
this problem because dynamic addresses start above the shared memory
attached addresses. Thus:
int *MyBigArray[2048]
for (idx1=0; idx1 < 2048; idx1++)
MyBigArray[idx1] = (int *)malloc( 1024 * sizeof (int) );
-OR-
int **MyBigArray;
MyBigArray = (int **)malloc( 2048 * sizeof (int *) );
for (idx1=0; idx1 < 2048; idx1++)
MyBigArray[idx1] = (int *)malloc( 1024 * sizeof (int) );
Art S. Kagel
Ji Young-Min wrote:
>
> Do you know how large array I can use in Informix ESQL/C ?
>
> Look into my attaching test program.
>
> When I declare some large array as "int MyBigArray[2048][1024];" ,
>
> I can't CONNECT to DB.
>
> $ esql myArrayTest.ec
> $ a.out>
> Error -25588: The appl process cannot connect to Dynamic server dbserver1.
> <-- Error Messages.
>
> But I comment out the declare statement as /* int MyBigArray[2048][1024];"
> */,
>
> DB CONNECT is OK!
>
> Are there any ESQL/C compile options?
>
> Or where can I find Informix parameters ?
>
> I want to use large array[es] in Informix ESQL/C.
>
> Please help me.
>
> Thanks.
>
> /* ===== Begin of my Big Array Test ===== */
>
> EXEC SQL include sqlca;
>
> int MyBigArray[2048][1024]; /* my Big Array */
>
> main()
> {
> char errmsg[400];
>
> EXEC SQL connect to 'tidb';
>
> if(SQLCODE != 0)
> {
> rgetmsg((short)SQLCODE, errmsg, sizeof(errmsg));
> printf("\\nError %d: ",SQLCODE);
> printf(errmsg, sqlca.sqlerrm);
> }
> else {
> printf("DB Connect OK!\\n");
> }
>
> EXEC SQL disconnect current;
> }
> /* ====== End of my Test ===== */
>
> --- ymji@thinkwaresys.com
As another alternative to Art Kagel's solution of modifying your code (that is
an 8 MB array,
assuming you're only using a machine with 32-bit ints), you can investigate
setting INFORMIXSHMBASE to some higher value too. Or switch to a connection
other than onipcshm.
Ji Young-Min wrote:
> Do you know how large array I can use in Informix ESQL/C?
> Look into my attaching test program.
>
> When I declare some large array as "int MyBigArray[2048][1024];" ,
>
> I can't CONNECT to DB.
>
> $ esql myArrayTest.ec
> $ a.out>
> Error -25588: The appl process cannot connect to Dynamic server dbserver1.
> <-- Error Messages.
>
> But I comment out the declare statement as /* int MyBigArray[2048][1024];"
> */,
>
> DB CONNECT is OK!
>
> Are there any ESQL/C compile options?
>
> Or where can I find Informix parameters ?
In the manual? The problem is knowing which one to look for. Such are the
wonders of very configurable systems.
--
Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net)
Guardian of DBD::Informix v0.62 -- see http://www.perl.com/CPAN
#include <disclaimer.h>
Related threads
- what's the matter with error -25588
- Re: "Network down" on fresh install
- The appl process cannot connect
- Error 25588 : IDS 7.31UD1 on Solaris8