602SQL Documentation Index  

wb_odbc_connect

PHP

mixed wb_odbc_connect( string dsn [, string uid [, string pwd ] ] )


Parameters

dsn
ODBC data source name
uid
user name for login to ODBC data source - optional
pwd
password for login to ODBC data source - optional


Since version

10.0

Description

This function creates a connection to ODBC data source that can be used for data transfer using the wb_data_transport function and for functions executing the XML transfers.

The dsn parameter specifies name of the data source that is registered in the operating system as system data source or user data source.

The uid and pwd parameters provide for connection to this data source. Some data sources do not require these entries.

An open connection must be closed using the wb_odbc_disconnect or wb_close function.



Returns

This function returns FALSE on error, or the PHP resource with an open connection to the ODBC data source.

Example

Read data from the MySQL server that is connected by means of ODBC data source that is registered as MySQL test, into the string variable. To use the XML API function wb_export_to_XML_buffer, an ODBC connection that is used in DAD definition must be open in advance.

...
  $odbc_resource = wb_odbc_connect("MySQL test","admin","password");
  $dad = "*Customers_mysql_analytDAD";
  $resXML = wb_export_to_XML_buffer($connection,$dad,NULL,NULL);
  wb_odbc_disconnect($odbc_resource);
...