| 1 | <HTML> |
| 2 | <HEAD> |
| 3 | <LINK REL="stylesheet" href="odbc.css"> |
| 4 | <TITLE>Introduction</TITLE> |
| 5 | </HEAD> |
| 6 | <BODY bgcolor="white"> |
| 7 | |
| 8 | <table width="90%" cols="3" border="0"> |
| 9 | <TR> |
| 10 | <TD colspan="3" class="big">Introduction</TD> |
| 11 | </TR> |
| 12 | <TR> |
| 13 | <TD colspan="3">Welcome to a short tutorial on ODBC programming. The goal of this tutorial is |
| 14 | to introduce a C-Programmer to ODBC programming. During this tutorial we will |
| 15 | code a simple program which connects to a database via ODBC and reads some data. |
| 16 | There won't be any information on how to program ODBC Drivers or about <EM>unixODBC</EM> |
| 17 | internals. Configuration won't be covered too. |
| 18 | The program developed throughout this tutorial was originally coded under WinNT |
| 19 | and later ported without any adjustments to Linux and <EM>unixODBC</EM>. This is |
| 20 | how compatibility should work :) |
| 21 | <P> |
| 22 | The information given within this tutorial are brief at best. Please |
| 23 | take it as a pointer where and how to start. |
| 24 | </P><BR> |
| 25 | </TD> |
| 26 | </TR> |
| 27 | </TABLE> |
| 28 | <TABLE COLS="3" Width="90%" border="0"> |
| 29 | <TR><TD class="head" width="25%">Requirements</TD> |
| 30 | <TD width="2%"> </TD> |
| 31 | <TD width="73%">I assume that you have</TD> |
| 32 | </TR> |
| 33 | <TR> |
| 34 | <TD colspan="2"> </TD> |
| 35 | <TD><UL> |
| 36 | <LI>a system with unixODBC installed and with at least one |
| 37 | working datasource configured. |
| 38 | <LI>the include files installed under <CODE>/usr/include/odbc</CODE> |
| 39 | <LI>a compiler installed and that you know how to use it ;) |
| 40 | </UL> |
| 41 | </TD> |
| 42 | </TR> |
| 43 | <TR><TD class="head" width="25%">Compiling</TD> |
| 44 | <TD width="2%"> </TD> |
| 45 | <TD>If gcc is installed type:</TD> |
| 46 | </TR> |
| 47 | <TR> |
| 48 | <TD colspan="2"> </TD> |
| 49 | <TD><CODE>gcc odbc.c -o odbc -lodbc</CODE><BR> |
| 50 | which will result in an executable named "odbc". |
| 51 | </TD> |
| 52 | </TR> |
| 53 | <TR><TD class="head"><A nAME="tab">Database</A></TD> |
| 54 | <TD width="20"> </TD> |
| 55 | <TD>Our database will have a single table:</TD> |
| 56 | </TR> |
| 57 | <TR> |
| 58 | <TD colspan="2"> </TD> |
| 59 | <TD><TABLE COLS=2 Border="0" bgcolor="#efefef"> |
| 60 | <TR> |
| 61 | <TH colspan=2 class="head">tkeyuser</TH> |
| 62 | </TR> |
| 63 | <TR> |
| 64 | <TD>iduser</TD> |
| 65 | <TD>sequence</TD> |
| 66 | </TR> |
| 67 | <TR> |
| 68 | <TD>dtname</TD> |
| 69 | <TD>char(40)</TD> |
| 70 | </TR> |
| 71 | <TR> |
| 72 | <TD>dtmaxSize</TD> |
| 73 | <TD>Integer</TD> |
| 74 | </TR> |
| 75 | |
| 76 | </TABLE> |
| 77 | <BR> |
| 78 | Our datasource will be named "web" and access is |
| 79 | granted to the user "christa" with no password. |
| 80 | </TD> |
| 81 | </TR> |
| 82 | |
| 83 | </table> |
| 84 | |
| 85 | </BODY> |
| 86 | </HTML> |