Link to home
Start Free TrialLog in
Avatar of eoincorrigan
eoincorrigan

asked on

Connecting to Sybase with C?

I want to write a C application that is capable of connection to Sybase Adaptive Server Enterprise 11.9.2 and executing queries and stored procedures.  
What embedded SQL tools do Sybase provide?  
I’ve used Oracle ProC precompilers in the past to connect to an Oracle database.  

I will be developing on Windows NT using MSVC 6.
Have you done something similar yourself?
What is the Sybase precompiler called?
What headers need to be included?
What library is linked to the code?
Avatar of amitpagarwal
amitpagarwal
Flag of India image

Hi,

If you already have Sybase, the installion CDs come with a samples directory. There you would find all the necessary 'c' code examples and header files.

A sample program looks like :
http://www.cs.sfu.ca/CourseCentral/Software/Sybase/DB-LIBRARY/node2.html

A good place for examples is :
http://www.talusmusic.com/BriansTools/Pages/Programs/PROGRAMLIST.html
http://sybooks.sybase.com

HTH,
Amit



Avatar of Edy1988
Edy1988

Hi,
You can use instead the DB-Library (equivalent to Oracle OCI), in order to use it you need to include:
sybfront.h
sybdb.h
syberror.h

The lib that you need to linkage is: Libsybdb.lib

EYAL
edy - if you notice above, the link i presented makes using of db-lib itself ..
Avatar of eoincorrigan

ASKER

I will award the points to the one who can tell me why I'm getting the following unresolved external symbols:

__sqlepilog
__sqlsetintrerr
__sqlctdiag
__sqlprolog
__sqlinitctx

All of therse are prototyped in Sqlhesql.h, which is included by the CPRE precompiler. Why arn't they resolved.
I'm linking to LIBCS.LIB and LIBCT.LIB so they are not in there!

What am I missing?
ASKER CERTIFIED SOLUTION
Avatar of Edy1988
Edy1988

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'm performing the precompilation step outside Visual Studio, and it's working fine.
And it compiles too. My problem is in the linking phase.
The symbols I mentioned above are declared in Sqlhesql.h but they are not defined there.  I must be missing a lib that contains the definitions for these functions.
The Sybase\Bin path is already in my executable file list.
Seems like the problem is in your code, can you send the code sample???

Eyal