ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:database:odbc

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
database:odbc [2015/11/26 23:49] – [Feature Limitations] mnewnhamv5:database:odbc [2021/01/11 09:59] (current) – typo peterdd
Line 1: Line 1:
-===== ODBC ===== +====== ODBC =====
-In addition to the genric ODBC driver for use with Windows ODBC drivers, there are additional ODBC drivers that provide extended support for database specific functions +~~NOTOC~~ 
-  * **odbc_mssql**. This can be used with the Microsoft Native Mode libraries for [[database:microsoft_sql_server#mssqlnative|SQL Server]] +In addition to the generic ODBC driver for use with Windows ODBC drivers, there are additional ODBC drivers that provide extended support for database specific functions 
-  * **odbc_oracle**. This can be used for connections to [[database:Oracle]] databases +----------------------- 
-  * **odbc_db2**This driver was originally the main connection to [[database:ibm_db2|DB2]] databasesSince the introduction of the db2 native driver it's status is unknown.+===== odbc ===== 
 +<WRAP right box round 300px> 
 +== Specification == 
 +^Driver Name|odbc| 
 +^Data Provider|odbc| 
 +^Status|Active((This driver is actively supported by ADOdb project members))| 
 +^Windows|Yes| 
 +^Unix|No| 
 +^ADOdb V5|Yes| 
 +^ADOdb V6|Yes| 
 +== Alternatives == 
 +[[v5:database:pdo#pdo_odbc|PDO driver for ODBC]] 
 +</WRAP> 
 +  * This generic driver can be used with any database with ODBC connection support.  
 +  * Connections can only be made using DSN connection strings or predefined ODBC connections.  
 +  Performance and functionality may be limited. 
 +  Writing portable applications that use this driver is not recommended. 
 +  * When configuring connections on Windows, ensure that the ODBC driver configuration (32 Bit/64 Bit) matches the installed PHP version. 
 +==== Setting The Cursor Mode ==== 
 +All ADOdb ODBC drivers can configure an appropriate cursor mode. The following modes are available through PHP. 
 +  * SQL_CUR_USE_IF_NEEDED   
 +  * SQL_CUR_USE_ODBC   
 +  * SQL_CUR_USE_DRIVER  
 +The cursor is set by setting the ''curmode'' prior to the connect statement 
 +<code php> 
 +include 'adodb/adodb.inc.php'; 
 +$db = newAdoConnection('odbc');
  
-<WRAP left 300px box> +$db->curmode = SQL_CUR_USE_IF_NEEDED; 
-|Driver Name|odbc+ 
-|Status|Active| +$db->connect('northwind'); 
-|Windows|Yes| +</code> 
-|Unix|No|+ 
 + 
 +------------------------------ 
 +===== odbc_mssql ===== 
 +<WRAP right box round 300px
 +== Specification == 
 +^Driver Name|odbc_mssql
 +^Data Provider|odbc| 
 +^Status|Active((This driver is actively supported by ADOdb project members))
 +^Windows|Yes| 
 +^Unix|No| 
 +^ADOdb V5|Yes| 
 +^ADOdb V6|Yes| 
 +== Alternatives ==  
 +[[v5:database:microsoft_sql_server#mssqlnative|SQL Server]]
 </WRAP> </WRAP>
-This preferred driver supports connections to databases using ODBC connectors+When used on Windows clients, this driver needs the Microsoft SQL server native client. There are feature limitations compared to the ''mssqlnative'' driver, use of that is always recommended. If you are using the driver with SQL Server versions 2012 and higher, consider using the odbc_mssql2012 driver instead, as 2012+ database specific fixes will be placed into that driver. 
 +------------------------------------ 
 +===== odbc_mssql2012 ===== 
 +<WRAP right box round 300px> 
 +== From ADOdb V5.21 == 
 +== Specification == 
 +^Driver Name|odbc_mssql2012| 
 +^Data Provider|odbc| 
 +^Status|Active((This driver is actively supported by ADOdb project members))| 
 +^Windows|Yes| 
 +^Unix|No| 
 +^ADOdb V5|Yes| 
 +^ADOdb V6|Yes| 
 +</WRAP> 
 +When used with SQL Server 2012, concatenation of strings results in a different behaviour compared with earlier versions. [[http://blog.sqlauthority.com/2013/05/12/sql-server-interesting-observation-of-concat_null_yields_null-and-concat-in-sql-server-2012-onwards/|This article]] explains the difference. 
 +--------------------------- 
 +===== odbc_oracle ===== 
 +<WRAP right box round 300px> 
 +== Specification == 
 +^Driver Name|odbc_oracle| 
 +^Data Provider|odbc| 
 +^Status|Active((This driver is actively supported by ADOdb project members))| 
 +^Windows|Yes| 
 +^Unix|No| 
 +^ADOdb V5|Yes| 
 +^ADOdb V6|Yes| 
 +</WRAP> 
 +--------------------------------------------- 
 +After connection, the date format is automatically set **by the driver** by executing the following statement: 
 +<code php> 
 +$sql = "ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'"; 
 +$db->execute($sql); 
 +</code> 
 +----------------------------------- 
 +==== odbc_db2 ==== 
 +<WRAP right box round 300px> 
 +== Specification == 
 +^Driver Name|odbc_db2| 
 +^Data Provider|odbc| 
 +^Status|Inactive((This driver is not actively supported or enhanced by ADOdb project members, but you can provide fixes and enhancements if you have the expertise))| 
 +^Windows|Yes| 
 +^Unix|No| 
 +^ADOdb V5|Yes| 
 +^ADOdb V6|Yes| 
 +== Alternatives == 
 +[[v5:database:ibm_db2|IBM DB2 Native Mode Driver]] 
 +</WRAP> 
 +Connects to DB2 database using either the IBM or 3rd party ODBC driver 
 +------------------------------------------ 
 +<WRAP tip> 
 +If the driver supports it setting the Cursor Type to ''SQL_CUR_USE_ODBC'' can provide substantial performance improvements. See top of this page for more information. 
 +</WRAP> 
 +<WRAP tip> 
 +== USING CLI INTERFACE ==
  
-===== Support Status ===== +There were reports that the $host and $database params have to be reversed in Connect() when using the CLI interface. 
-This driver is actively supported by ADOdb project members+</WRAP>
  
 +<WRAP tip>
 +== System Error 5 ==
 +IF you get a System Error 5 when trying to Connect/Load, it could be a permission problem. Give the user connecting
 +to DB2 full rights to the DB2 SQLLIB directory, and place the user in the DBUSERS group.
  
-===== Feature Limitations ===== +</WRAP>
-ODBC connections have functionality limitations include transactional handling. See the [[database:feature_comparison|Feature Matrix]] for more information +
-{{tag>[odbc windows active supported]}}+
  
 +-------------------------------------------------
 +
 +===== Feature Limitations =====
 +ODBC connections have functionality limitations include transactional handling. See the [[v5:database:feature_comparison|Feature Matrix]] for more information
 +{{tag>[odbc windows active supported tier2]}}
v5/database/odbc.1448578169.txt.gz · Last modified: 2017/04/21 11:24 (external edit)