[freetds] Newcomer to FreeTDS - in search of sample C code fo r a relative b eginner

Thompson, Bill D (London) bill_d_thompson at ml.com
Tue Mar 30 06:30:54 EST 2004

Hi Andy,

Welcome to FreeTDS - You've done well so far....

The API's you can use are industry standard.

1) db-library as documented by Sybase (on their website) or MS (in SQL
server books online)
2) ct-library as documented by Sybase 
3) ODBC 

I'd recommend db-library myself unless you are already familiar with sybase

in our source you'll find  src/dblib/unittests  , src/ctlib/unittests ,

therein are many test programs which server well as examples of how to use
the API's

as an alternative to tsql, you can download sqsh (www.sqsh.org) which can be
configured to use freetds libraries (instead of sybase's libraries)

this provides a robust and fully functional equivalent to "isql" . 

If you have any more questions, just ask...



> -----Original Message-----
> From:	Andy Cranston [SMTP:a.cranston at selwaymoore.com]
> Sent:	30 March 2004 12:23
> To:	'freetds at lists.ibiblio.org'
> Subject:	[freetds] Newcomer to FreeTDS - in search of sample C code
> for a relative b eginner
> Hello list,
> I am a newcomer to FreeTDS and I am in search of sample C code to show me
> how to access a Microsoft SQL Server database from a C program on a UNIX
> system.  Here are my platform details:
>   UNIX side:
>   Solaris 8 running on a Sun Microsystems Ultra-1
>   FreeTDS version 0.61
>   GNU gcc version 3.2.2
>   Database side:
>   Windows NT Server 4.0 service pack 6a
>   Microsoft SQL Server version 8.0 / 2000
> I compiled and installed FreeTDS "out of the box" (./configure, make, make
> install).
> I can use the tsql utility to access the databases on the SQL Server
> although I do need to login as the Administrator user supplying the
> Windows
> NT domain admin password if I want to be able to see all the tables in
> each
> database.
> I have gotton as far as selecting columns of information from selected
> tables via a UNIX expect script which drives a tsql session but I would
> like
> to do this "properly" by using a suitable API from within a C program to
> connect to the database, authenticate, issue one or more select statements
> and then gracefully close the connection.
> I have had a look at the FAQ on the FreeTDS website but have not found any
> sample code for using an API from C.  I'm probably just looking in the
> wrong
> place (apologies if I am) but if somebody could point me in the right
> direction to get started I'd be very grateful.
> Regards,
> Andy Cranston.
> ________________________________________________________________________
> This message has been checked for all known viruses by the Selway Moore
> scanning service powered by MessageLabs. For further information and
> statistics on current viruses visit http://www.messagelabs.com/stats.asp
> ________________________________________________________________________
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds


If you are not an intended recipient of this e-mail, please notify
the sender, delete it and do not read, act upon, print, disclose,
copy, retain or redistribute it.

Click here for important additional terms relating to this e-mail.


More information about the FreeTDS mailing list