55<FirstName>Tim</FirstName>
66<Surname>Goeke</Surname>
77</Author>
8+ <Author>
9+ <FirstName>Thomas</FirstName>
10+ <Surname>Lockhart</Surname>
11+ </Author>
812</AuthorGroup>
9- <Date>Transcribed 1998-02-12 </Date>
13+ <Date>1998-08-25 </Date>
1014</DocInfo>
1115
12- <Title>ODBC Interface</Title>
16+ <Title><acronym> ODBC</acronym> Interface</Title>
1317
1418<Para>
1519<Note>
1620<Para>
17- Contributed by <ULink url="mailto:tgoeke@xpressway.com">Tim Goeke</ULink>
21+ Background information originally by
22+ <ULink url="mailto:tgoeke@xpressway.com">Tim Goeke</ULink>
1823</Para>
1924</Note>
2025
2126<Para>
22- ODBC is an abstract API which allows you to write standard "ODBC" code,
23- using the ODBC API.
27+ <acronym>ODBC</acronym> (Open Database Connectivity) is an abstract
28+ <acronym>API</acronym>
29+ which allows you to write standard "ODBC" applications.
30+ <acronym>ODBC</acronym> provides a product-neutral interface
31+ between frontend applications and database servers,
32+ allowing a user or developer to write applications which are portable among servers.
2433
2534<Sect1>
2635<Title>Background</Title>
2736
2837<Para>
29- The ODBC API matches up on the backend to an ODBC compatible data source.
30- This could be anything from a text file to an Oracle RDBMS.
38+ The <acronym>ODBC</acronym> <acronym>API</acronym> matches up
39+ on the backend to an <acronym>ODBC</acronym>-compatible data source.
40+ This could be anything from a text file to an Oracle or
41+ <productname>Postgres</productname> <acronym>RDBMS</acronym>.
3142
3243<Para>
33- The backend access come from ODBC drivers, or vendor specifc drivers that
34- allow data access.PostODBC is such a driver, along with others that are
35- available, such as the OpenLink ODBC drivers.
44+ The backend access come from<acronym> ODBC</acronym> drivers, or vendor specifc drivers that
45+ allow data access.<productname>psqlODBC</productname> is such a driver, along with others that are
46+ available, such as the OpenLink<acronym> ODBC</acronym> drivers.
3647
3748<Para>
38- Once you write an ODBC application, you SHOULD be able to connect to ANY
49+ Once you write an<acronym> ODBC</acronym> application, you SHOULD be able to connect to ANY
3950back end database, regardless of the vendor, as long as the database schema
4051is the same.
4152
4253<Para>
43- For example. you could have MS SQL Server and PostgreSQL servers which have
44- exactly the same data. Using ODBC, your Windows app would make exactly the
54+ For example. you could have <productname>MS SQL Server</productname>
55+ and <productname>Postgres</productname> servers which have
56+ exactly the same data. Using <acronym>ODBC</acronym>, your Windows app would make exactly the
4557same calls and the back end data source would look the same (to the windows
4658app).
4759
60+ <para>
61+ <ulink url="http://www.insightdist.com/">Insight Distributors</ulink> provides active and ongoing
62+ support for the core <productname>psqlODBC</productname> distribution. They provide a
63+ <ulink url="http://www.insightdist.com/psqlodbc/"><acronym>FAQ</acronym></ulink>, ongoing development
64+ on the code base, and actively participate on the
65+ <ulink url="mailto:interfaces@postgresql.org">interfaces mailing list</ulink>.
66+
67+ <sect1>
68+ <title><productname>Windows</productname> Applications</title>
69+
4870<Para>
49- In the real world, differences in drivers and the level of ODBC support
50- lessens the potential of ODBC:
71+ In the real world, differences in drivers and the level of<acronym> ODBC</acronym> support
72+ lessens the potential of<acronym> ODBC</acronym> :
5173
5274<SimpleList>
5375<Member>
54- Access, Delphi, and Visual Basic all support ODBC directly.
76+ Access, Delphi, and Visual Basic all support<acronym> ODBC</acronym> directly.
5577
5678<Member>
57- Under C++, such as Visual C++, you can use the C++ ODBC API.
79+ Under C++, such as Visual C++, you can use the C++<acronym> ODBC</acronym> <acronym> API</acronym> .
5880
5981<Member>
60- In Visual C++, you can use the CRecordSet class, which wraps the ODBC API
61- set within and MFC 4.2 class. This is the easiest route if you are doing
82+ In Visual C++, you can use the CRecordSet class, which wraps the
83+ <acronym>ODBC</acronym> <acronym>API</acronym>
84+ set within an MFC 4.2 class. This is the easiest route if you are doing
6285Windows C++ development under Windows NT.
6386</SimpleList>
6487
6588<Para>
66- If I write an app for PostgreSQL can I write it using ODBC calls
67- to the PostgreSQL server, or is that only when another database program
89+ If I write an app for <productname>Postgres</productname>
90+ can I write it using <acronym>ODBC</acronym> calls
91+ to the <productname>Postgres</productname> server, or is that only when another database program
6892like MS SQL Server or Access needs to access the data?
6993
7094<Para>
71- Again, the ODBC API set is the way to go. You can find out more at
72- Microsoft's web site or in your Visual C++ docs (if that's what you are
73- using.)
95+ Again, the<acronym> ODBC</acronym> <acronym> API</acronym> set is the way to go.
96+ You can find out more at
97+ Microsoft's web site or in your Visual C++ docs (if that's what you are using.)
7498
7599<Para>
76- Visual Basic and the other RAD tools have Recordset objects that use ODBC
100+ Visual Basic and the other RAD tools have Recordset objects that use<acronym> ODBC</acronym>
77101directly to access data. Using the data-aware controls, you can quickly
78- link to the ODBC back end database (<Emphasis>very</Emphasis> quickly).
102+ link to the<acronym> ODBC</acronym> back end database (<Emphasis>very</Emphasis> quickly).
79103
80104<Para>
81105Playing around with MS Access will help you sort this out. Try using
@@ -88,11 +112,107 @@ You'll have to set up a DSN first.
88112</Para>
89113</Tip>
90114
115+ <!--
91116<Para>
92117<Tip>
93118<Para>
94- ThePostgreSQL datetime type will break MS Access.
119+ The<productname>Postgres</productname> datetime type will break MS Access.
95120</Para>
96121</Tip>
122+ -->
123+
124+ <sect1>
125+ <title><productname>Unix</productname> Applications</title>
126+
127+ <para>
128+ <productname>ApplixWare</productname> has an <acronym>ODBC</acronym> database interface
129+ supported on at least some platforms. <productname>ApplixWare</productname> v4.4.1 has been
130+ demonstrated under Linux with <productname>Postgres</productname> v6.4
131+ using the <productname>psqlODBC</productname>
132+ driver contained in the <productname>Postgres</productname> distribution.
133+
134+ <sect2>
135+ <title>Configuration Files</title>
136+
137+ <para>
138+ The <filename>~/.odbc.ini</filename> contains user-specified access information
139+ for the <productname>psqlODBC</productname>
140+ driver. The file uses conventions typical for <productname>Windows</productname>
141+ Registry files, but despite this
142+ restriction can be made to work.
143+
144+ <para>
145+ Here is an example <filename>.odbc.ini</filename> file,
146+ showing access information for three databases:
147+
148+ <programlisting>
149+ [ODBC Data Sources]
150+ DataEntry = Read/Write Database
151+ QueryOnly = Read-only Database
152+ Test = Debugging Database
153+ Default = Postgres Stripped
154+
155+ [DataEntry]
156+ ReadOnly = 0
157+ Servername = localhost
158+ Database = Sales
159+
160+ [QueryOnly]
161+ ReadOnly = 1
162+ Servername = localhost
163+ Database = Sales
164+
165+ [Test]
166+ Debug = 1
167+ CommLog = 1
168+ ReadOnly = 0
169+ Servername = localhost
170+ Username = tgl
171+ Password = "no$way"
172+ Port = 5432
173+ Database = test
174+
175+ [Default]
176+ Servername = localhost
177+ Database = tgl
178+ Driver = /opt/postgres/current/lib/libpsqlodbc.so
179+
180+ [ODBC]
181+ InstallDir = /opt/applix/axdata/axshlib
182+ </programlisting>
183+
184+ <para>
185+ For Applix, here is an example ~/axhome/macros/login.am file:
186+ <programlisting>
187+ macro login
188+ set_set_system_var@("sql_username@","tgl")
189+ set_system_var@("sql_passwd@","no$way")
190+ endmacro
191+ </programlisting>
192+
193+ <sect1>
194+ <title>Supported Platforms</title>
195+
196+ <para>
197+ <productname>psqlODBC</productname> has been built and tested
198+ on <productname>Linux</productname>. There have been reports of success
199+ with FreeBSD and with Solaris.
97200
98201</Chapter>
202+
203+ <!-- Keep this comment at the end of the file
204+ Local variables:
205+ mode: sgml
206+ sgml-omittag:t
207+ sgml-shorttag:t
208+ sgml-minimize-attributes:nil
209+ sgml-always-quote-attributes:t
210+ sgml-indent-step:1
211+ sgml-indent-data:t
212+ sgml-parent-document:nil
213+ sgml-default-dtd-file:"../reference.ced"
214+ sgml-exposed-tags:nil
215+ sgml-local-catalogs:"/usr/lib/sgml/catalog"
216+ sgml-local-ecat-files:nil
217+ End:
218+ -->