C / ESQL / INFORMIX question
Posted in 2000
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Hi, hope someone can help. I'm running Informix SE 7.22 on UNIXWARE 2.1.3. I am writing a C /ESQL program to interrogate this database using CURSOR and FETCH routines. I have DECLARED and OPENED the cursor and set up a FETCH loop. I have 2 problems: 1. I need to perform the fetch a number of times, each time starting from the first record in the database but when I run it the first fetch loop works but subsequent times no records are found. Do I somehow need to reinitialise the cursor?? 2. Withing the fetch loop I need to call a UNIX commad using the system command but whenever I do this I lose the connection to the database and all subsequent fetches fail. Should I be able to do this or is there another way around it. Any help would be appreciated.
Slaphead wrote: > Hi, hope someone can help. > I'm running Informix SE 7.22 on UNIXWARE 2.1.3. I am writing a C /ESQL > program to interrogate this database using CURSOR and FETCH routines. I have > DECLARED and OPENED the cursor and set up a FETCH loop. I have 2 problems: > 1. I need to perform the fetch a number of times, each time starting from > the first record in the database but when I run it the first fetch loop > works but subsequent times no records are found. Do I somehow need to > reinitialise the cursor?? Do a "close cursor" and "open cursor" for each subsequent loop through the result set. The "close cursor" basically reinitializes the cursor. > 2. Withing the fetch loop I need to call a UNIX commad using the system > command but whenever I do this I lose the connection to the database and all > subsequent fetches fail. Should I be able to do this or is there another way > around it. There shouldn't be any problem with using system(). Could you post the relevant part of your code? You say that you are loosing the connection to the database - what error number do you receive? Hope this helps, Heiko > Any help would be appreciated.
> There shouldn't be any problem with using system(). Could you post the relevant > part of your code? You say that you are loosing the connection to the database - > what error number do you receive? Keep in mind - if you make fork(), you can't use the same connection in child and parent process you must to close current connection in child or in parent. Heiko Giesselmann <heiko.giesselmann@informix.com> ''''' ' ''''''''':39EDDFC2.14540A70@informix.com... > Slaphead wrote: > > > Hi, hope someone can help. > > I'm running Informix SE 7.22 on UNIXWARE 2.1.3. I am writing a C /ESQL > > program to interrogate this database using CURSOR and FETCH routines. I have > > DECLARED and OPENED the cursor and set up a FETCH loop. I have 2 problems: > > 1. I need to perform the fetch a number of times, each time starting from > > the first record in the database but when I run it the first fetch loop > > works but subsequent times no records are found. Do I somehow need to > > reinitialise the cursor?? > > Do a "close cursor" and "open cursor" for each subsequent loop through the > result set. The "close cursor" basically reinitializes the cursor. > > > 2. Withing the fetch loop I need to call a UNIX commad using the system > > command but whenever I do this I lose the connection to the database and all > > subsequent fetches fail. Should I be able to do this or is there another way > > around it. > > There shouldn't be any problem with using system(). Could you post the relevant > part of your code? You say that you are loosing the connection to the database - > what error number do you receive? > > Hope this helps, Heiko > > > Any help would be appreciated. >