Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><a href="http://www.iodbc.org/" rel="noreferrer">iODBC</a> is installed by default as part of Mac OS X; has been since Jaguar (10.2.x). There's no need for UnixODBC on Macs, and it can lead to lots of errors if you're not a serious expert. There is a specific guide to using <a href="http://www.iodbc.org/dataspace/iodbc/wiki/iODBC/IODBCPHPHOWTOMacOSX" rel="noreferrer">PHP with iODBC on Mac OS X</a>. For best results, you may also want to upgrade to the latest <a href="http://www.iodbc.org/dataspace/iodbc/wiki/iODBC/Downloads#Mac_OS_X" rel="noreferrer">iODBC for Mac OS X</a>.</p> <p><code>/opt/local/etc</code> should <em>not</em> be added to your <code>$PATH</code>, through <code>.profile</code> or otherwise.</p> <p>PHP is definitely finding iODBC before UnixODBC, but this should not be a problem; UnixODBC and iODBC are generally (and are meant to be fully) API-equivalent ODBC driver managers. If you're really concerned about that part, you can change the <code>$DYLD_LIBRARY_PATH</code> (Mac OS X's version of Linux's <code>$LD_LIBRARY_PATH</code>) -- but if PHP was linked against the iODBC Frameworks, as opposed to the dylibs, this won't make any difference. </p> <p>(Note that <code>$DYLD_LIBRARY_PATH</code> also must include <code>/opt/local/lib</code> or your FreeTDS driver won't load.)</p> <p>For the specific error your report -- PHP needs to have a couple of environment variables set, if you're not using the Mac's default ODBC configuration files (System level are in <code>/Library/ODBC/odbc[inst].ini</code>; User level are in <code>~/Library/ODBC/odbc[inst].ini</code> ... if there are <code>~/.odbdc[inst].ini</code> files present, they should be blended into the <code>~/Library/ODBC/</code> files and replaced by symlinks to the same). </p> <p>If you don't want to use iODBC, or don't want to use those default files, you have to set <code>$ODBCINI</code> to target the <code>odbc.ini</code> file where you've defined your DSN, and <code>$ODBCINSTINI</code> to target the <code>odbcinst.ini</code> file which registers the driver you want to use.</p> <p>Assuming you want to do all of the above, lines like these should be added to your <code>*.php</code> files (optimally via a <code>require</code> or <code>include</code> statement to minimize future editing) --</p> <pre><code>putenv("DYLD_LIBRARY_PATH=/path/to/odbcsdk/lib;$DYLD_LIBRARY_PATH"); putenv("ODBCINSTINI=/path/to/odbcinst.ini"); putenv("ODBCINI=/path/to/odbc.ini"); </code></pre> <p>I can't be exact about the <code>DYLD_LIBRARY_PATH</code> setting, because you didn't specify where your UnixODBC libraries are. However, if you are OK with iODBC being the driver manager, and just want your FreeTDS libraries to load, the following should work --</p> <pre><code>putenv("DYLD_LIBRARY_PATH=/opt/local/lib;$DYLD_LIBRARY_PATH"); putenv("ODBCINSTINI=/opt/local/etc/odbcinst.ini"); putenv("ODBCINI=/opt/local/etc/odbc.ini"); </code></pre> <p>I hope this helps.</p> <p>P.S. In your DSN definition, this line --</p> <pre><code>Driver = FreeTDS </code></pre> <p>-- should be rewritten. Either the human-friendly driver name should be wrapped in braces (<code>{FreeTDS}</code>), or the full-path to the driver library (<code>/opt/local/lib/libtdsodbc.so</code>) should be the value instead.</p> <pre><code>Driver = {FreeTDS} Driver = /opt/local/lib/libtdsodbc.so </code></pre> <p>I'm presuming that you also have something like the following index entry in your <code>odbcinst.ini</code> --</p> <pre><code>[ODBC Drivers] FreeTDS = Installed </code></pre> <p>-- and something like the following index entry in your <code>odbc.ini</code> --</p> <pre><code>[ODBC Data Sources] bti_dsn = FreeTDS </code></pre> <p>...but now I notice that your $conn line may just need correction. Look at the arguments to <code>odbc_connect</code>. </p> <pre><code>$conn = odbc_connect('bti_dsn;, $user, $pw); </code></pre> <p>That should probably look more like --</p> <pre><code>$conn = odbc_connect("bti_dsn", "$user", "$pw"); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload