[freetds] C/C++: Library usage in linux and windows

Juan Perez laslistas at gmail.com
Wed Sep 5 09:21:24 EDT 2007


Thak you Richard.

If i understand well you say me to use FreeTDS.dll (I think i will use
the same in Windows and in Linux) instead dblib.lib .

  But, where i can find a sample of this in C/C++ (¿what include files
i need?¿where is a sample to use this?), and what is the process to do
it?
  I readed the "FreeTDS User Guide" and i understand that there are
some possible configurations to do it. I don´t know what is the best
for me but, suposssing that i selected one, i don´t know "How to get
what works with it working" (chapter 6 in user guide). There is
nothing about C/C++.


Than you in advance.

2007/9/5, Richard Krehbiel <richard.krehbiel at gmail.com>:
> I migrated a substantial code base (700K+ lines) from Windows to Linux, and
> the database portion was a piece of cake.
>
> The key ingredient for your C++ program is to use the ODBC API.  After that
> you can compile on Windows or Linux, no sweat.  ODBC isolates the program
> from the database drivers.  So on Windows you can use either FreeTDS or MS
> drivers, and on Linux (where MS drivers aren't available) you can use
> FreeTDS.
>
> Furthermore, you can change database vendors with very little impact on your
> code (just SQL syntax changes).  Not only did I port from Windows to Linux,
> but with only a little more work (only SQL syntax tweaks) I ported from MS
> SQL Server to MySQL.  The driver is loaded at run time by the connection
> details;  you can retarget to  Oracle or PostgreSQL or IBM DB2 or Ingres or
> Sybase; all have Windows and Linux drivers.
>
> On 9/5/07, Juan Perez <laslistas at gmail.com> wrote:
> >
> > Hi all:
> >
> >   I am new to FreeTDS.
> >   We are developing an application that have to run in Windows and Linux.
> >   The program is written in C/C++. The same application works in Linux
> > and in Windows.
> >   This application has to be connections to Microsoft Sql Server.
> > Simple connections: some select and some simple insert sentences.
> >
> >    I found FreeTDS and I supose this could make the work.
> >
> >    I am able to generate dblib.lib, FreeTDS.dll and libTDS.lib with
> > MSVC (and i supose than i can generate this libraries for Linux).
> >    I read in the documentation that the most stable is dblib, so i
> > decide to use it. But the problem is that i don´t know how.
> >    My first testing place is Windows.  I want to create a simple
> > project that conects to a database, makes a select and prints the
> > result.
> >    So I included in the project dblib.lib library and... i dont know
> > what include files y need. I try to compile the samples
> > (src\odbc\unittests) without result.
> >    I know i am making something bad, but i don´t know what.
> > Can somebody help me?
> >
> > Thanks in advance and excuse me for my poor english.
> >
> > bye...
> > _______________________________________________
> > FreeTDS mailing list
> > FreeTDS at lists.ibiblio.org
> > http://lists.ibiblio.org/mailman/listinfo/freetds
> >
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
>


More information about the FreeTDS mailing list