<html> <head><title>DB_odbtp</title></head> <body> <h2>DB_odbtp</h2> <a href="#overview">Overview</a><br> <a href="#require">Requirements</a><br> <a href="#dsn">DSN specification</a><br> <a href="#odbtp">ODBTP options</a><br> <a href="#odbc">ODBC options</a><br> <a href="#dbsyntax">Databases supported by dbsyntax</a><br> <a href="#exampledsn">Example DSN specifications</a><br> <br> <br> <a name="overview"><h3>Overview</h3></a> DB_odbtp is a <a href="http://pear.php.net/package/DB">PEAR DB</a> driver that connects to a database using ODBTP (Open Database Transport Protocol). ODBTP allows any platform to remotely access the ODBC facilities on a Win32 host to connect to a database. A PHP application on a Linux, UNIX or Novell platform will be able to access a Microsoft SQL Server, Microsoft Access, Visual FoxPro, or any other database residing on a Win32 platform. <p> PHP developers on Windows can use the odbtp driver instead of the odbc, ado and mssql drivers. The odbtp extension provides better performance and more capabities than the extensions used by the other drivers. For example, Microsoft Access and Microsoft SQL Server can store UNICODE text data. However, the odbtp driver is the only one that provides full support for UNICODE text data and queries. The odbtp driver also has the exact behaviour on both Win32 and non-Win32 installations. <br> <br> <a name="require"><h3>Requirements</h3></a> The DB_odbtp package requires the prior installation of the ODBTP PHP extension and Win32 service. These components can be obtained at <a href="http://odbtp.sourceforge.net">http://odbtp.sourceforge.net</a>. The ODBTP service must be installed on a WinNT, WinXP or Win2K host whose ODBC facilities can access the desired database. The ODBTP extension and DB_odbtp package can be installed on any computer that can connect to the ODBTP service. <br> <br> <a name="dsn"><h3>DSN specification</h3></a> Full specification: <pre> odbtp(dbsyntax)://username:password@hostspec:port/database?opt1=val1&opt2=val2...&optN=valN</pre> Minimal specification: <pre> odbtp://hostspec</pre> The <code>dbsyntax</code> option can be any one of the following values:<p> <code>access</code> -- Microsoft Access<br> <code>db2</code> -- IBM DB2<br> <code>dsn</code> -- General ODBC DSN<br> <code>excel</code> -- Microsoft Excel<br> <code>mssql</code> -- Microsoft SQL Server<br> <code>mysql</code> -- MySQL<br> <code>oracle</code> -- Oracle<br> <code>sybase</code> -- Sybase<br> <code>text</code> -- Text Files<br> <code>vfp</code> -- Visual FoxPro <p> The <code>hostspec</code> option can either be the hostname or IP address of an ODBTP service, or it can be the name of an <a href="http://odbtp.sourceforge.net/interface.html">ODBTP interface</a>. In the case of the minimal specification, <code>hostspec</code> must be the name of an interface. The default value for <code>hostspec</code> is <code>127.0.0.1</code>. <p> For more details about PEAR DB's DSN specification, see <a href="http://pear.php.net/manual/en/package.database.db.intro-dsn.php">Introduction - DSN</a> from the PEAR Manual. <br> <br> <a name="odbtp"><h3>ODBTP options</h3></a> <table cellpadding="0" cellspacing="0" border="0"> <tr><td><b>Name</b></td><td><b>Description</b></td></tr> <tr><td> </td><td> </td></tr> <tr><td valign="top"><nobr><code>connid </code></nobr></td> <td valign="top"> ODBTP connection Id. This is only required when reconnecting to a reserved connection. </td></tr> <tr><td> </td><td> </td></tr> <tr><td valign="top"><nobr><code>conntimeout </code></nobr></td> <td valign="top"> ODBTP TCP/IP connection timeout in seconds. </td></tr> <tr><td> </td><td> </td></tr> <tr><td valign="top"><nobr><code>conntype </code></nobr></td> <td valign="top"> ODBTP connection type. it can either be <code>single</code>, <code>reserved</code> or <code>normal</code>. The default is <code>normal</code>. </td></tr> <tr><td> </td><td> </td></tr> <tr><td valign="top"><nobr><code>dbparam </code></nobr></td> <td valign="top"> The name of the ODBC connect string parameter for specifying the database. The value is ODBC driver dependent. Examples are <code>DATABASE</code>, <code>DBQ</code>, <code>SOURCEDB</code> and <code>DSN</code>. The default is <code>DATABASE</code>. </td></tr> <tr><td> </td><td> </td></tr> <tr><td valign="top"><nobr><code>odbcport </code></nobr></td> <td valign="top"> The ODBC connect string <code>PORT</code> parameter value. This option is included to eliminate ambiguity with the PEAR DB DSN's <code>port</code> option. </td></tr> <tr><td> </td><td> </td></tr> <tr><td valign="top"><nobr><code>odbcprotocol </code></nobr></td> <td valign="top"> The ODBC connect string <code>PROTOCOL</code> parameter value. This option is included to eliminate ambiguity with the PEAR DB DSN's <code>protocol</code> option. </td></tr> <tr><td> </td><td> </td></tr> <tr><td valign="top"><nobr><code>readtimeout </code></nobr></td> <td valign="top"> ODBTP TCP/IP read timeout in seconds. </td></tr> <tr><td> </td><td> </td></tr> <tr><td valign="top"><nobr><code>rowcache </code></nobr></td> <td valign="top"> Enable row caching. If set to <code>yes</code>, then all row data will be placed in memory immediately after quere execution. This allows predetermination of row counts, and backward fetches without having to use a cursor. </td></tr> <tr><td> </td><td> </td></tr> <tr><td valign="top"><nobr><code>txnisol </code></nobr></td> <td valign="top"> Transaction isolation level to use when auto commit has been disabled. Valid values are <code>ReadUncommitted</code>, <code>ReadCommitted</code>, <code>RepeatableRead</code>, <code>Serializable</code> and <code>Default</code>. </td></tr> <tr><td> </td><td> </td></tr> <tr><td valign="top"><nobr><code>unicode </code></nobr></td> <td valign="top"> Enable UNICODE query text processing. If set to <code>yes</code>, then all query text will be read as UTF-8 encoded UNICODE text. And, if the underlying database is Microsoft Access, all text data will be returned as UTF-8 encoded UNICODE text. </td></tr> <tr><td valign="top"><nobr><code>vardatasize </code></nobr></td> <td valign="top"> Sets the maximum allowed byte size for variable length data, i.e., CLOBs (text) and BLOBs (image). The default is 64KB. </td></tr> <tr><td> </td><td> </td></tr> </table> <br> <br> <a name="odbc"><h3>ODBC options</h3></a> If an option is not recognized as a PEAR DB DSN or ODBTP option, then it is assumed to be an ODBC connect string option. Thus, unrecognized options are added to the ODBC connect string that will be sent to the ODBTP server. <br> <br> <a name="dbsyntax"><h3>Databases supported by dbsyntax</h3></a> <table cellpadding="0" cellspacing="0" border="0"> <tr><td><b>Database</b></td><td><nobr><b>dbsyntax </b></nobr></td> <td><b>Additionally defined options and their defaults</b></td></tr> <tr><td> </td><td> </td><td> </td></tr> <tr><td valign="top"><nobr>Microsoft Access </nobr></td> <td valign="top"><nobr>access </nobr></td> <td valign="top"><pre>'dbparam' => 'DBQ' 'driver' => '{Microsoft Access Driver (*.mdb)}' 'username' => 'admin' 'password' => '' </pre></td></tr> <tr><td valign="top"><nobr>IBM DB2 </nobr></td> <td valign="top"><nobr>db2 </nobr></td> <td valign="top"><pre>'dbparam' => 'DATABASE' 'driver' => '{IBM DB2 ODBC Driver}' 'hostname' => 'localhost' 'odbcport' => '50000' 'odbcprotocol' => 'TCPIP' </pre></td></tr> <tr><td valign="top"><nobr>General ODBC DSN </nobr></td> <td valign="top"><nobr>dsn </nobr></td> <td valign="top"><pre>'dbparam' => 'DSN' </pre></td></tr> <tr><td valign="top"><nobr>Microsoft Excel </nobr></td> <td valign="top"><nobr>excel </nobr></td> <td valign="top"><pre>'dbparam' => 'DBQ' 'driver' => '{Microsoft Excel Driver (*.xls)}' 'driverid' => '790' </pre></td></tr> <tr><td valign="top"><nobr>Microsoft SQL Server </nobr></td> <td valign="top"><nobr>mssql </nobr></td> <td valign="top"><pre>'dbparam' => 'DATABASE' 'driver' => '{SQL Server}' 'server' => '(local)' </pre></td></tr> <tr><td valign="top"><nobr>MySQL </nobr></td> <td valign="top"><nobr>mysql </nobr></td> <td valign="top"><pre>'dbparam' => 'DATABASE' 'driver' => '{mySQL}' 'server' => 'localhost' 'odbcport' => '3306' 'option' => '131072' 'stmt' => '' </pre></td></tr> <tr><td valign="top"><nobr>Oracle </nobr></td> <td valign="top"><nobr>oracle </nobr></td> <td valign="top"><pre>'dbparam' => 'DBQ' 'driver' => '{Oracle ODBC Driver}' </pre></td></tr> <tr><td valign="top"><nobr>Sybase </nobr></td> <td valign="top"><nobr>sybase </nobr></td> <td valign="top"><pre>'dbparam' => 'DATABASE' 'driver' => '{Sybase ASE ODBC Driver}' 'srvr' => 'localhost' </pre></td></tr> <tr><td valign="top"><nobr>Text Files </nobr></td> <td valign="top"><nobr>text </nobr></td> <td valign="top"><pre>'dbparam' => 'DBQ' 'driver' => '{Microsoft Text Driver (*.txt; *.csv)}' 'extensions' => 'asc,csv,tab,txt' </pre></td></tr> <tr><td valign="top"><nobr>Visual FoxPro </nobr></td> <td valign="top"><nobr>vfp </nobr></td> <td valign="top"><pre>'dbparam' => 'SOURCEDB' 'driver' => '{Microsoft Visual FoxPro Driver}' 'sourcetype' => 'DBF' 'exclusivee' => 'NO' </pre></td></tr> </table> <br> <br> <a name="#exampledsn"><h3>Example DSN specifications</h3></a> <b>A. MS SQL Server and ODBTP server on different hosts.</b> <pre>$dsn = 'odbtp(mssql)://myuid:mypwd@odbtp.someehere.com/mydb?server=myserver';</pre> <b>B. MS SQL Server and ODBTP server on same host.</b> <pre>$dsn = 'odbtp(mssql)://myuid:mypwd@myserver/mydb';</pre> <b>C. PHP not on same host as MS Access database and ODBTP server.</b> <pre>$dsn = 'odbtp(access)://207.66.121.4/c:\somepath\mydb.mdb';</pre> <b>D. PHP, MS Access database and ODBTP server on same host. UNICODE support enabled.</b> <pre>$dsn = 'odbtp(access):///c:\somepath\mydb.mdb?unicode=yes';</pre> <b>E. An ODBTP server that does not listen on port 2799, the default.</b> <pre>$dsn = 'odbtp(access)://207.66.121.4:7255/c:\somepath\mydb.mdb';</pre> <b>F. MS Excel spreadsheet on remote ODBTP server.</b> <pre>$dsn = 'odbtp(excel)://odbtp.somewhere.com/c:\somepath\mysheet.xls';</pre> <b>G. Text files on local ODBTP server. Row cache enabled.</b> <pre>$dsn = 'odbtp(text):///c:\PathToTextFiles?rowcache=yes';</pre> <b>H. Visual FoxPro database on remote ODBTP server.</b> <pre>$dsn = 'odbtp(vfp)://207.66.121.4/c:\PathToDBFs';</pre> <b>I. Visual FoxPro DBC on local ODBTP server.</b> <pre>$dsn = 'odbtp(vfp):///c:\somepath\mydb.dbc?sourcetype=DBC';</pre> <b>J. DSN array for Sybase. Connection type set to single.</b> <pre>$dsn = array( 'phptype' => 'odbtp', 'dbsyntax' => 'sybase', 'hostspec' => 'odbtp.somewhere.com', 'username' => 'myuid', 'password' => 'mypwd', 'database' => 'mydb', 'srvr' => 'mysrvr', 'conntype' => 'single' );</pre> <b>K. IBM DB2 not listening on port 50000, the default.</b> <pre>$dsn = 'odbtp(db2)://myuid:mypwd@207.66.121.4/mydb?odbcport=51000';</pre> <b>L. Connection to Oracle. ODBTP read timeout set to 300 seconds</b> <pre>$dsn = 'odbtp(oracle)://myuid:mypwd@odbtp.someehere.com/mydb?readtimeout=300';</pre> <b>M. General ODBC DSN on locat ODBTP server.</b> <pre>$dsn = 'odbtp(dsn):///mydsn';</pre> <b>N. Connecting with an ODBTP interface.</b> <pre>$dsn = 'odbtp://myinterface';</pre> <b>O. Database for which a dbsyntax value has not been defined.</b> <pre>$dsn = array( 'phptype' => 'odbtp', 'driver' => '{INTERSOLV InterBase ODBC Driver (*.gdb)}', 'hostspec' => '207.66.121.4', 'server' => 'localhost', 'username' => 'myuid', 'password' => 'mypwd', 'database' => 'localhost:C:\Home\Data\Mydb.gdb', 'dbparam' => 'DATABASE' );</pre> </body> </html>