Skip to Content.
Sympa Menu

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

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Andy Cranston <a.cranston AT selwaymoore.com>
  • To: "'freetds AT lists.ibiblio.org'" <freetds AT lists.ibiblio.org>
  • Subject: [freetds] Newcomer to FreeTDS - in search of sample C code for a relative b eginner
  • Date: Tue, 30 Mar 2004 12:22:33 +0100

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
________________________________________________________________________




Archive powered by MHonArc 2.6.24.

Top of Page