<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0042)http://odbtp.sourceforge.net/DB_odbtp.html -->
<HTML><HEAD><TITLE>DB_odbtp</TITLE>
<META http-equiv=Content-Type content="text/html; charset=koi8-u">
<META content="MSHTML 6.00.2800.1561" name=GENERATOR></HEAD>
<BODY>
<b>See <a href="http://odbtp.sourceforge.net/DB_odbtp.html">last updated version</a></b>
<H2>DB_odbtp</H2><A
href="http://odbtp.sourceforge.net/DB_odbtp.html#overview">Overview</A><BR><A
href="http://odbtp.sourceforge.net/DB_odbtp.html#require">Requirements</A><BR><A
href="http://odbtp.sourceforge.net/DB_odbtp.html#dsn">DSN
specification</A><BR><A
href="http://odbtp.sourceforge.net/DB_odbtp.html#odbtp">ODBTP options</A><BR><A
href="http://odbtp.sourceforge.net/DB_odbtp.html#odbc">ODBC options</A><BR><A
href="http://odbtp.sourceforge.net/DB_odbtp.html#dbsyntax">Databases supported
by dbsyntax</A><BR><A
href="http://odbtp.sourceforge.net/DB_odbtp.html#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:hide@address.com: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 cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<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></TBODY></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 cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<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></TBODY></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:hide@address.com/mydb?server=myserver';</PRE><B>B.
MS SQL Server and ODBTP server on same host.</B> <PRE>$dsn = 'odbtp(mssql)://myuid:hide@address.com/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:hide@address.com/mydb?odbcport=51000';</PRE><B>L.
Connection to Oracle. ODBTP read timeout set to 300 seconds</B> <PRE>$dsn = 'odbtp(oracle)://myuid:hide@address.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>