⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 odbc.sgml

📁 关系型数据库 Postgresql 6.5.2
💻 SGML
📖 第 1 页 / 共 2 页
字号:
The file uses conventions typical for <productname>Windows</productname> Registry files, but despite this restriction can be made to work.</Para><para>The <filename>.odbc.ini</filename> file has three required sections. The first is <literal>[ODBC Data Sources]</literal>which is a list of arbitrary names and descriptions for each database you wish to access. The second required section is the Data Source Specification and there will be one of these sectionsfor each database. Each section must be labeled with the name given in <literal>[ODBC Data Sources]</literal> and must contain the following entries: <programlisting>Driver = <replaceable>POSTGRESDIR</replaceable>/lib/libpsqlodbc.soDatabase=<replaceable>DatabaseName</replaceable>Servername=localhostPort=5432</programlisting><tip><para>Remember that the <productname>Postgres</productname> database name isusually a single word, without path names of any sort. The <productname>Postgres</productname> server manages the actual accessto the database, and you need only specify the name from the client.</Para></tip>Other entries may be inserted to control the format of the display. The third required section is <literal>[ODBC]</literal> which must contain the <literal>InstallDir</literal> keyword and which may contain other options.</Para><para>Here is an example <filename>.odbc.ini</filename> file, showing access information for three databases:<programlisting>[ODBC Data Sources]DataEntry = Read/Write DatabaseQueryOnly = Read-only DatabaseTest = Debugging DatabaseDefault = Postgres Stripped[DataEntry]ReadOnly = 0Servername = localhostDatabase = Sales[QueryOnly]ReadOnly = 1Servername = localhostDatabase = Sales[Test]Debug = 1CommLog = 1ReadOnly = 0Servername = localhostUsername = tglPassword = "no$way"Port = 5432Database = test[Default]Servername = localhostDatabase = tglDriver = /opt/postgres/current/lib/libpsqlodbc.so[ODBC]InstallDir = /opt/applix/axdata/axshlib</programlisting></Para></sect1><sect1><title>ApplixWare</title><sect2><title>Configuration</title><para><productname>ApplixWare</productname> must be configured correctly in order for it tobe able to access the <productname>Postgres</productname> <acronym>ODBC</acronym> software drivers.</Para><procedure><title>Enabling ApplixWare Database Access</title><para>These instructions are for the 4.4.1 release of <productname>ApplixWare</productname> on <productname>Linux</productname>.Refer to the <citetitle>Linux Sys Admin</citetitle> on-line book for more detailed information.</Para><step performance="required"><para>You must modify <filename>axnet.cnf</filename> so that <filename>elfodbc</filename> canfind <filename>libodbc.so</filename> (the <acronym>ODBC</acronym> driver manager) shared library.This library is included with the ApplixWare distribution,but <filename>axnet.cnf</filename> needs to be modified to point to the correct location.</Para><para>As root, edit the file<filename><replaceable>applixroot</replaceable>/applix/axdata/axnet.cnf</filename>.</Para><substeps><step performance="required"><para>At the bottom of <filename>axnet.cnf</filename>,find the line that starts with<programlisting>#libFor elfodbc /ax/<replaceable>...</replaceable></programlisting></Para></step><step performance="required"><para>Change line to read<programlisting>libFor elfodbc <replaceable>applixroot</replaceable>/applix/axdata/axshlib/lib</programlisting>which will tell elfodbc to look in this directoryfor the <acronym>ODBC</acronym> support library.If you have installed applix somewhere else,change the path accordingly.</Para></step></substeps></step><step performance="required"><para>Create <filename>.odbc.ini</filename> as described above.  You may also want to add the flag<programlisting>TextAsLongVarchar=0</programlisting>to the database-specific portion of <filename>.odbc.ini</filename>so that text fields will not be shown as <literal>**BLOB**</literal>.</Para></step></procedure><procedure><title>Testing ApplixWare ODBC Connections</title><step performance="required"><para>    Bring up <application>Applix Data</application></Para></step><step performance="required"><para>Select the <productname>Postgres</productname> database of interest.</Para><substeps><step performance="required"><para>Select <command>Query->Choose Server</command>.  </Para></step><step performance="required"><para> Select <acronym>ODBC</acronym>, and click <command>Browse</command>.The database you configured in <filename>.odbc.ini</filename>    should be shown.  Make sure that the <option>Host: field</option> is empty (if it is not, axnet will try to contact axnet on another machine to look for the database).</Para></step><step performance="required"><para>Select the database in the box that was launched by <command>Browse</command>, then click <command>OK</command>.</Para></step><step performance="required"><para>Enter username and password in the login identification dialog, and click <command>OK</command>.</Para></step></substeps><para>    You should see <quote>Starting elfodbc server</quote> in the lower left corner of the    data window.  If you get an error dialog box, see the debugging section    below.</Para></step><step performance="required"><para>    The 'Ready' message will appear in the lower left corner of the data    window.  This indicates that you can now enter queries.</Para></step><step performance="required"><para>    Select a table from Query->Choose tables, and then select Query->Query    to access the database.  The first 50 or so rows from the table should    appear.</Para></step></procedure></sect2><sect2><title>Common Problems</title><para>The following messages can appear while trying to make an<acronym>ODBC</acronym> connection through <productname>Applix Data</productname>:<variablelist><varlistentry><term>Cannot launch gateway on server</term><listitem><para><literal>elfodbc</literal> can't find <filename>libodbc.so</filename>.  Check your <filename>axnet.cnf</filename>.</Para></listitem></varlistentry><varlistentry><term>Error from ODBC Gateway:IM003::[iODBC][Driver Manager]Specified driver could not be loaded</term><listitem><para><filename>libodbc.so</filename> cannot find the driver listed in<filename>.odbc.ini</filename>. Verify the settings.</Para></listitem></varlistentry><varlistentry><term>Server: Broken Pipe</term><listitem><para>	 The driver process has terminated due to some other	 problem.  You might not have an up-to-date version	 of the <productname>Postgres</productname><acronym>ODBC</acronym> package.</Para></listitem></varlistentry><varlistentry><term>setuid to 256: failed to launch gateway</term><listitem><para>The September release of ApplixWare v4.4.1 (the first release with official<acronym>ODBC</acronym> support under Linux) shows problems when usernamesexceed eight (8) characters in length.Problem description ontributed by <ulink url="mailto:scampbell@lear.com">Steve Campbell</ulink>.</Para></listitem></varlistentry></variablelist></para><para><note><title>Author</title><para>Contributed by <ulink url="mailto:scampbell@lear.com">Steve Campbell</ulink> on1998-10-20.</para></note>The <application>axnet</application> program's security system seems a little suspect. <application>axnet</application> does things on behalf of the user and on a true multiple user system it really should be run with root security (so it can read/write in each user's directory).  I would hesitate to recommend this, however, since we have no idea what security holes this creates.</para></sect2><sect2><title>Debugging ApplixWare ODBC Connections</title><para>One good tool for debugging connection problems uses the Unix systemutility <application>strace</application>.</para><procedure><title>Debugging with strace</title><step performance="required"><para>Start applixware.</para></step><step performance="required"><para>Start an <application>strace</application> onthe axnet process.  For example, if<programlisting>ps -aucx | grep ax </programlisting>shows<programlisting>cary   10432  0.0  2.6  1740   392  ?  S  Oct  9  0:00 axnetcary   27883  0.9 31.0 12692  4596  ?  S   10:24  0:04 axmain</programlisting></para><para>Then run<programlisting>   strace -f -s 1024 -p 10432 </programlisting></para></step><step performance="required"><para>Check the strace output.</para><note><title>Note from Cary</title><para>Many of the error messages from <productname>ApplixWare</productname>go to <filename>stderr</filename>, but I'm not sure where <filename>stderr</filename>is sent, so <application>strace</application> is the way to find out.</para></note></step></procedure><para>  For example, after gettinga <quote>Cannot launch gateway on server</quote>, I ran strace on axnet and got<programlisting>[pid 27947] open("/usr/lib/libodbc.so", O_RDONLY) = -1 ENOENT    (No such file or directory)[pid 27947] open("/lib/libodbc.so", O_RDONLY) = -1 ENOENT    (No such file or directory)[pid 27947] write(2, "/usr2/applix/axdata/elfodbc:    can't load library 'libodbc.so'\n", 61) = -1 EIO (I/O error)</programlisting>  So what is happening is that applix elfodbc is searching for libodbc.so, but itcan't find it.  That is why axnet.cnf needed to be changed.</para></sect2><sect2><title>Running the ApplixWare Demo</title><para>In order to go through the <citetitle>ApplixWare Data Tutorial</citetitle>, you need to createthe sample tables that the Tutorial refers to.  The ELF Macro used tocreate the tables tries to use a NULL condition on many of the database columns,and <productname>Postgres</productname> does not currently allow this option.</para><para>To get around this problem, you can do the following:</para><procedure><title>Modifying the ApplixWare Demo</title><step performance="required"><para>Copy <filename>/opt/applix/axdata/eng/Demos/sqldemo.am</filename> to a local directory.</para></step><step performance="required"><para>Edit this local copy of <filename>sqldemo.am</filename>:</para><substeps><step performance="required"><para>Search for 'null_clause = "NULL"</para></step><step performance="required"><para>Change this to null_clause = ""</para></step></substeps></step><step performance="required"><para>Start <application>Applix Macro Editor</application>.</para></step><step performance="required"><para>Open the sqldemo.am file from the <application>Macro Editor</application>.</para></step><step performance="required"><para>Select <command>File->Compile and Save</command>.</para></step><step performance="required"><para>Exit <application>Macro Editor</application>.</para></step><step performance="required"><para>Start <application>Applix Data</application>.</para></step><step performance="required"><para>Select <command>*->Run Macro</command></para></step><step performance="required"><para>Enter the value <quote>sqldemo</quote>, then click <command>OK</command>.</para><para>You should see the progress in the status line of the data window (in the lower left corner).</para></step><step performance="required"><para>You should now be able to access the demo tables.</para></step></procedure></sect2><sect2><title>Useful Macros</title><para>You can add information about yourdatabase login and password to the standard Applix startupmacro file. This is an example <filename>~/axhome/macros/login.am</filename> file:<programlisting>macro login    set_set_system_var@("sql_username@","tgl")    set_system_var@("sql_passwd@","no$way")endmacro</programlisting><caution><para>You should be careful about the file protections on any file containingusername and password information.</para></caution></para></sect2><sect2><title>Supported Platforms</title><para><productname>psqlODBC</productname> has been built and testedon <productname>Linux</productname>. There have been reports of successwith FreeBSD and with Solaris. There are no known restrictionson the basic code for other platforms which already support<productname>Postgres</productname>.</para></sect2></sect1></Chapter><!-- Keep this comment at the end of the fileLocal variables:mode: sgmlsgml-omittag:tsgml-shorttag:tsgml-minimize-attributes:nilsgml-always-quote-attributes:tsgml-indent-step:1sgml-indent-data:tsgml-parent-document:nilsgml-default-dtd-file:"./reference.ced"sgml-exposed-tags:nilsgml-local-catalogs:"/usr/lib/sgml/CATALOG"sgml-local-ecat-files:nilEnd:-->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -