Web студия "GrandView"
  Главная   Написать Контакты
   
   
О проекте
Руководство php
 

odbc_connect

(PHP 3 >= 3.0.6, PHP 4, PHP 5)

odbc_connect -- Connect to a datasource

Description

resource odbc_connect ( string dsn, string user, string password [, int cursor_type] )

Returns an ODBC connection id or 0 (FALSE) on error.

The connection id returned by this functions is needed by other ODBC functions. You can have multiple connections open at once as long as they either use different db or different credentials. The optional fourth parameter sets the type of cursor to be used for this connection. This parameter is not normally needed, but can be useful for working around problems with some ODBC drivers.

With some ODBC drivers, executing a complex stored procedure may fail with an error similar to: "Cannot open a cursor on a stored procedure that has anything other than a single select statement in it". Using SQL_CUR_USE_ODBC may avoid that error. Also, some drivers don't support the optional row_number parameter in odbc_fetch_row(). SQL_CUR_USE_ODBC might help in that case, too.

The following constants are defined for cursortype:

  • SQL_CUR_USE_IF_NEEDED

  • SQL_CUR_USE_ODBC

  • SQL_CUR_USE_DRIVER

  • SQL_CUR_DEFAULT

For persistent connections see odbc_pconnect().



odbc_cursor> <odbc_commit
Last updated: Fri, 26 Jan 2007
 
add a note add a note User Contributed Notes
odbc_connect
Kalle Sommer Nielsen
19-Sep-2007 06:07
You may find lots of DSN strings at:
http://www.connectionstrings.com/
stefanov at uk dot ibm dot com
29-Aug-2007 02:15
As a follow up to my previous post regarding "PHP get data from IBM Tivoli Netcool ObjectServer (Sybase database)", the link to the article has changed and is now:

http://pimmy.co.uk/index.php/ObjectServer_PHP

Regards,

Pimmy
exkludge at gmail dot com
16-Jan-2007 04:02
After doing "harald dot angel at gmail dot com" suggestion, you may still receive this error:

"Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data., SQL state S1000 in SQLConnect in... "

You may need to include the <computer name> of the machine where the ODBC is, to the <local group> of the machine where the *.mdb is stored. And make sure that the <local group> has enough permission to access the *.mdb.

hope this make somebody more happy!

more power to opensource.
francesco_NO_SPAM_at_paladinux_dot_net
07-Jan-2007 11:33
For connection to Informix database via ODBC, there are some problem (depending from the version of DB).
It's possible, if you have ver. 2.x or 3.x, than in insert query mode a double string, the server answer :
[Informix][Informix ODBC Driver][Informix]Character to numeric conversion error, SQL state 37000 in SQLExecDirect in server/page.php.
The only way to resolve the problem to resolve the problem is add the US-English locales to the PHP connection.

Paladinux
harald dot angel at gmail dot com
06-Dec-2006 06:12
- Windows - OS
- Apache
- ODBC-Connction to MS-Access DB on a:
- Network Share

After many hours searching here
Новости
11 июля 2007
Сайт запущен
© 2007 info@grandviewstudio.com

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 324

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 330
Z058440144362 Z348613067571