[Info-ingres] OpenAPI connect - what am I missing?


    Sponsored Links


  • 1. Formatting dates on insert or update - Helprequired please
    The YYYY_MM_DD format works under all II_DATE_FORMAT's so here is my solution: select c(date_part('year', 'today'))+'_'+c(date_part('month', 'today')) +'_'+c(date_part('day', 'today')) or if you want leading zeros: select right(varchar(date_part('year', 'today')+10000),4) + '_' + right(varchar(date_part('month', 'today')+100),2) + '_' + right(varchar(date_part('day', 'today')+100),2) Mike
  • 2. Problemas con Ingres release 3
    Hi Osvaldo, Alway post the full error: E_OP0487_NOEQCLS consistency check - no joining equivalence class found when expected Also seen with: E_OP0901_UNKNOWN_EXCEPTION Unknown exception occurred in optimizer utility. Value is 68197. I had a similar error on 2.6, AIX 5.2 a while ago, caused by a BIG bit of SQL, it brought down the iidbms in fact. The system had run out of OPF Memory. If your symptoms are similar to the above, I suggest you re-configure the system (use cbf) with a big amount of OPF Memory and re-start Ingres. Good Luck Steve On 6 Aug, 13:34, "osvaldo" < XXXX@XXXXX.COM > wrote: > Tengo el siguiente error al ejecutar un query dentro de un report (.rw): > > "E_0P0487 consistency check no joining equivalent class found when expected" > > Tengo el Ingres r3 sobre Red Hat 9. > Alguien sabe algo? > > Osvaldo.
  • 3. [Info-Ingres] Problemas con Ingres release 3
    This is a multi-part message in MIME format. Tengo el siguiente error al ejecutar un query dentro de un report (.rw): "E_0P0487 consistency check no joining equivalent class found when expected" Tengo el Ingres r3 sobre Red Hat 9. Alguien sabe algo? Osvaldo. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <META content="MSHTML 6.00.2900.2180" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#ffffff> <DIV><FONT face=Arial size=2>Tengo el siguiente error al ejecutar un query dentro de un report (.rw):</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>"E_0P0487 consistency check no joining equivalent class found when expected"</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Tengo el Ingres r3 sobre Red Hat 9. </FONT></DIV> <DIV><FONT face=Arial size=2>Alguien sabe algo?</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Osvaldo.</FONT></DIV></BODY></HTML>
  • 4. alter table alter column weirdness
    On Jul 20, 12:16 am, XXXX@XXXXX.COM wrote: > create table x (a varchar(20) not null not default, b integer not null not > default) with page_size=4096\g > alter table x alter column a varchar(20) with null not default\g Isn't that an erroneous statement? Not sure if not default and with null have ever been able to co-exist. If R3 accepted it, that would be a bug in R3.

[Info-ingres] OpenAPI connect - what am I missing?

Postby martin.bowes » Thu, 16 Jun 2005 21:27:29 GMT

Hi Everyone,

I'm trying to synchronously connect to a database using OpenAPI.

I have initialised a parameter block, got a pointer to it, passed this to 
IIapi_connect and keep getting knocked back with:
 gp_status=6 (ie.IIAPI_ST_NOT_INITIALIZED )

Anyone got any ideas whats not initialised? There are no errors in the 
errlog. And given that this is an IIAPI_ST_NOT_INITIALIZED error 
there are no details in gp_errorHandle.

Hmm. Do I have to initialise gp_errorHandle...

Code snippet is:
int Connect_DB(char *dbname, IIAPI_CONNPARM *ConnParm) {

int errorno;
char errortext[1024];

/* Initialise the Parmeter Block */
/* First: Allocate some memory for it! */
ConnParm=calloc(1, sizeof(IIAPI_CONNPARM));
if (!ConnParm) {
    printf("Memory Allocation Error initialising Parameter Block for 
    exit (1);

ConnParm->co_target=calloc(1, 32*sizeof(char));
if (!ConnParm->co_target) {
    printf("Memory Allocation Error Connect_DB.co_target\n");
    exit (1);

ConnParm->co_username=calloc(1, 32*sizeof(char));
if (!ConnParm->co_username) {
    printf("Memory Allocation Error Connect_DB.co_username\n");
    exit (1);
printf("Connect_DB: memory allocation completed! %x\n",ConnParm);
/* Second: store some data in it! */
printf("Connect_DB: Init Parameter Block\n");
strcpy(ConnParm->co_target, dbname);    /*Connect to this database*/
strcpy(ConnParm->co_username, "ingres");/*as ingres*/
ConnParm->co_timeout=-1;                /*with No Timeout */
ConnParm->co_connHandle = NULL;
ConnParm->co_tranHandle = NULL;

ConnParm->co_genParm.gp_callback = NULL;
ConnParm->co_genParm.gp_closure = NULL;


Martin Bowes
Random Duckman Quote #44:
Duckman - It looks a lot worse than what it is.
Cornfed - Not unlike {*filter*} Cramps.

RE: [Info-ingres] OpenAPI connect - what am I missing?

Postby Croker, Grant » Thu, 16 Jun 2005 22:15:26 GMT


Has IIapi_initialize() been called beforehand? I believe you also need
set ConnParm->co_connHandle to the environment handle generated by

Check out $II_SYSTEM/ingres/demo/api/apisconn.c for a working example
connect with OpenAPI.

ta - g

RE: [Info-ingres] OpenAPI connect - what am I missing?

Postby martin.bowes » Thu, 16 Jun 2005 22:55:04 GMT

Hi Grant

Ah! {*filter*}!

Serves me right for using an II2.0 manual. 

Thanks heaps!


Random Duckman Quote #60:
Duckman: She's hideous! She's got a face that would scatter a leper 
         You gotta look at her through a box with a little hole in it.

Similar Threads:

1.[Info-ingres] [ingres] [Info-ingres] Logging trace conundrum - what am I missing?


>> Hi Dudes,
>> II2.6/0305 for linux
>> Someone is going to answer this one with a simple one line response
>> and I'm going to kick myself, but here goes...
>             Judging by the thundering silence either:
> - No one cares.              
> - No one believes me
> - No one knows
I can't speak for anyone else but I didn't see the original message. 
I've just checked google groups and the original appears as a reply to 
the reply - which is odd.


2.[Info-ingres] OpenAPI Caling a database procedure

Hi Grant et al,

I'm trying call a database procedure synchronously from an OpenAPI 
application. The procedure has no parameters, all I want is the return 
value. My understanding is that I set IIapi_query to say I'm executing a 
database procedure. It will not do anything until the necessary 
parameters (including procedure name and owner) are supplied and 
filled in.

However, the code seems to hang at the initial iiapi_query() call. 

I am using in order the following:
    I don't wait on gp_completed.


    I then allocate storage for two parameter descriptors for the 
    array setDescParm.sd_descriptor. In each element of which I 
    set ds_dataType = IIAPI_CHA_TYPE,
    ds_nullable = FALSE, 
    ds_columnType = IIAPI_COL_SVCPARM
    ds_columnName = NULL

    I wait on gp_completed.

	Fill in the procedure name, owner values described above, call 
the procedure an wait on gp_completed.

At this point I wait on the IIapi_query to complete.
Then I call IIapi_get_QueryInfo to pick up the procedure return value.

Martin Bowes
Random Farscape Quote #26:
John     - I think we have to put Grandma in a home.
Ka'Dargo - We could burn her.
John     - You burn your old people!
Ka'Dargo - No, but in her case...

3.[Info-ingres] OpenAPI Weirdness

Hi Grant et al,

Sorry to bother you directly Grant, but I'm at my wits end on this one 
and could use some advice. If anyone else in the newsgroup would like 
to chip in 2c worth, I'd be happy too.

I've written a C program which has a subroutine full of API stuff. This 
subroutine controls connecting to three databases in sequence to do 
stuff. From the final database connection it reads in a lot (17511 rows) 
of data to the program before disconnecting and then terminating the 
API before returning to the main program. 

All of which appears to work perfectly well. The data returned to the 
program is exactly what is in the database.

But after the IIapi_terminate succeeds, the subroutine will return a 
TRUE. Diagnostics indicates this is all happening. But the subroutine 
NEVER returns to the main program. Instead it either loops? or causes 
a coredump.

The code is literally:
main (...) {
if (Generate_Analysed_Data(&SayWhat)) {
    printf("Generate_Analysed_Data completed OK!\n");
} else {
    printf("Unexpected Error: Failed to Generate Analysed Data\n");
    printf("Program Aborts\n");
    exit (1);
} /*main*/

int Generate_Analysed_Data ( ParmDetails *buf) {
... stuff ...
/* Initialise OpenAPI */
if (!Init_API(&InitParm)) {return(FALSE);};
... Lots of stuff ...
/* In all cases we an now terminate the API connection */
printf("Terminate me!\n");
if (!Terminate_API) {
    printf("Failure in API termination!\n");

printf("Generate_Analysed_Data returns %d\n", ret_value);
return (ret_value);
} /*Generate_Analysed_Data*/

int Terminate_API (void) {
if ( termParm.tm_status != IIAPI_ST_SUCCESS ) {
    printf( "Open_API::Terminate_API. Error in IIapi_terminate: %d\n",
        termParm.tm_status );
return termParm.tm_status;
} /*Terminate_API*/

The diagnostic output is:
Terminate me!
Generate_Analysed_Data returns 1
Segmentation fault (core dumped)

I've run in api_trace mode (5) and the trace file (1.2M) is beautiful:
grep 'status =' $II_SYSTEM/ingres/files/api_trace.log| grep -v 
!IIapi_appCallback: request completed, status = NO_DATA

All the connects/disconnects are cool. All started statements are 
closed, commits are issued etc.

I've run this on II2.5 and from an II2.6 installation using vnodes back to 
the II2.5 database and the effect is the same. 

Any Ideas gratefully received. I have the core dump and dbx but I have 
no idea what I'm looking for or how to drive dbx....

Martin Bowes
Random Duckman Quote #20:
Ajax    - By the hand of Zeus what manner of deviltry is this?
          I mean... what gives?

4.[Info-ingres] OpenAPI Status Codes

5.[Info-ingres] OpenAPI Parameter Place Holders

Hi Grant et al,

If you have a spare second or two....

Is there any difference between using the '?' place holder for an SQL 
statement and using a '~V'?

eg insert into fred values(?,?,?,?) works.

But if we change the '?' to space tilda V space. The query fails with 
Illegal binarty value in query text
OpenAPI function cannot be called in current state.

We get the first if we set queryParm.qy_parameters=FALSE or TRUE 

The manual suggests  these are equivalenet and hints that ~V is 
preferred - although we may be reading too much into that...

Martin Bowes
Random Duckman Quote #89:
Cornfed: I'm sorry I slapped you Duckman, but I was trying to calm you 
Duckman: And I guess just saying "calm down" would be considered 

6. [Info-ingres] OpenAPI error function called in wrong state

7. [Info-ingres] OpenAPI Calling a database procedure

8. [Info-ingres] OpenAPI Status Codes

Return to DATABASE


Who is online

Users browsing this forum: No registered users and 96 guest