Discussion:
Problem with C program and DB connections through ODBC
(too old to reply)
IKUSI SIP
2003-12-22 15:06:54 UTC
Permalink
Hello,

We are using Openserver 5.0.5 and Development 5.1.1A.
we have a problem in a very simple C program, it only connects to
Oracle through Openlink Odbcs.
We compile it with cc, but it won't connect with a DSN resolution
error. If we insert a junk code line ("if (isdigit(5))return 0;") the
program works well and it connects to the DB.
We think it must be a memory overflow or a problem with the compiler,
because the same program (without the junk code line) compiles and
works well in other machines, with the same software installed. Does
anybody have the same or similar problem??

This is the makefile:

LIBS = $(HOME)/lib_sipa/general.a -L$(ODBCHOME)/lib -liodbc
-lsocket
-lx

DatosCIT.e: DatosCIT.c DatosCIT.h
cc -DSCO -g -b elf -o $(HOME)/exe/DatosCIT.e
-I$(ODBCHOME)/include -I$(H
OME)/include_sipa DatosCIT.c $(LIBS)

thank you very much.
J. L. Schilling
2004-01-02 18:37:59 UTC
Permalink
Post by IKUSI SIP
We are using Openserver 5.0.5 and Development 5.1.1A.
we have a problem in a very simple C program, it only connects to
Oracle through Openlink Odbcs.
We compile it with cc, but it won't connect with a DSN resolution
error. If we insert a junk code line ("if (isdigit(5))return 0;") the
program works well and it connects to the DB.
We think it must be a memory overflow or a problem with the compiler,
because the same program (without the junk code line) compiles and
works well in other machines, with the same software installed.
Memory overflow is unlikely, because the junk code line wouldn't change
anything. Depending upon where the junk code line is located, this sounds
like either some weird timing issue or a compiler code generation bug,
with the latter being more likely. Try compiling with the -O option instead
of -g to see if that changes anything. Or you could try using GCC on
OpenServer instead of the OSR5 Dev Sys compiler. (You probably can't use
the third alternative, the UDK compiler for OSR5, because you have to
link against your existing ODBC library.) But if you've found a
non-painful work-around, be glad of that....

Jonathan Schilling

Loading...