I tried to run the embedded SQL in C simple example from the ASA
programming Interfaces Guide and
I encounter with some problem.
The following code is from the document.
------------------------------------------------------------------------
#include <stdio.h>
EXEC SQL INCLUDE SQLCA;
main()
{
db_init(&sqlca);
EXEC SQL WHENEVER SQLERROR GOTO ERROR;
EXEC SQL CONNECT "dba" IDENTIFIED BY "sql";
EXEC SQL UPDATE employee
set emp_lname = 'Plankton'
where emp_id = 195;
EXEC SQL COMMIT WORK;
EXEC SQL DISCONNECT;
db_fini(&sqlca);
return (0);
error:
printf("update successful -- sqlcode = %ld.n", sqlca.sqlcode );
db_fini(&sqlca);
return (-1);
}
-------------------------------------------------------------------------------
I named the above program as example.sqc
When I run,
sqlpp -oUNIX example.sqc
It generates the C source.
But when I compile it (cc example.c ), it responds with the following
error messages.
cpp: "example.c", line 13: error 4036: Can't open include file
'sqlca.h'.
cpp: "example.c", line 24: error 4036: Can't open include file
'sqlda.h'.
Can someone help me with this.
Thanks,
Connie
--
Reg Domaratzki, Sybase iAnywhere Solutions
Certified SQL Anywhere Associate
Please reply only to the newsgroup
ASA Patches and EBFs : http://downloads.sybase.com/swx/sdmain.stm
-> Choose SQL Anywhere Studio
-> Set "Platform Preview" and "Time Frame" to ALL and click "GO"
"LMCO" <conni...@lmco.com> wrote in message news:3B684DB6...@lmco.com...
Connie
Include directories are not picked up from environment variables as far as I
know so you need the -I parameter, and you will need to link against the
dblib7 library. This assumes libdblib7.so is in your library path
(LD_LIBRARY_PATH for Solaris and Linux). See
/opt/sybase/SYBSsa7/cxmp/makeall for how to build the examples.
--
Ian McHardy
iAnywhere Solutions (A Sybase Company)
Please reply to the newsgroup, not by e-mail.
"LMCO" <conni...@lmco.com> wrote in message
news:3B685D82...@lmco.com...
Is there a command just compile the Embedded SQL in C/C++
and generate the object code without compile the C code (generates from the
sqlpp)?
Thanks,
Connie
> I don't have libdblib7.so in /opt/sybase/SYBSsa7/lib directory.
> Where can I get the libdblib7.so or how can I build one?
It's installed in ${ASANY}/lib by the installer. (You're sourcing the
${ASANY}/bin/asa_config.[c]sh script, right?)
> Is there any ASA documentation on this issue?
It's probably discussed in the "installatino" or "how to install" section of
the manual.
> Is there a command just compile the Embedded SQL in C/C++
> and generate the object code without compile the C code (generates from
the
> sqlpp)?
Under ASA, the ESQL/C code is not "compiled" -- it is preprocessed by the
SQL preprocessor (sqlpp). There is no integrated C compiler & SQL
preprocessor available from Sybase. Instead, just run sqlpp and then run
gcc on the generated C source code.
(There is a lot of documentation on ESQL/C in the Reference Guide, as well
as an explanation of ESQL/C and the preprocessing of source code.)
-k
Connie
If not, for HP-UX you need to either:
1) source /opt/sybase/SYBSsa7/bin/asa_config.csh (or .sh) to setup PATH and
SH_LIB_PATH
2) add /opt/sybase/SYBSsa7/lib to SH_LIB_PATH
3) add -L/opt/sybase/SYBSsa7/lib to the cc command line.
If that still doesn't work, check out the cc options used by make -f makeall
in the cxmp directory (you probably need to copy the files in cxmp to an
other directory with write permission).
-- Ian McHardy
iAnywhere Solutions (A Sybase Company)
Please reply to the newsgroup, not by e-mail.
"LMCO" <conni...@lmco.com> wrote in message
news:3B6AA216...@lmco.com...