odbc_connect
Function • Params and return types changed in PHP 8.4
Connect to a datasource.
odbc_connect Function synopsis
odbc_connect(
string $dsn,
?string $user = null,
?string $password = null,
int $cursor_option = SQL_CUR_USE_DRIVER
): Odbc\Connection|false
Parameters
$dsn
Typestring
The database source name for the connection. Alternatively, a DSN-less connection string can be used.
$user
OptionalType?stringDefault valuenull
The username.
This parameter is ignored if $dsn contains uid.
To connect without specifying a $user,
use null.
$password
OptionalType?stringDefault valuenull
The password.
This parameter is ignored if $dsn contains pwd.
To connect without specifying a $password,
use null.
$cursor_option
OptionalTypeintDefault valueSQL_CUR_USE_DRIVER
This 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.
Return value
TypeOdbc\Connection|false
Returns an ODBC connection, or false on failure.
Changes to the odbc_connect Function
PHP 8.4
- Return type added:
Odbc\Connection|false - Parameter type changed for parameter #2 (
$user):stringto?string - Parameter default value added for position #2 (
$user):null - Parameter type changed for parameter #3 (
$password):stringto?string - Parameter default value added for position #3 (
$password):null
odbc_connect(
string $dsn,
- string $user,
+ ?string $user = null,
- string $password,
+ ?string $password = null,
int $cursor_option = SQL_CUR_USE_DRIVER
- )
+ ): Odbc\Connection|false PHP 8.2
- Attribute added for parameter
$password:#[SensitiveParameter]
PHP 8.0
- Parameter type added for parameter #1 (
$dsn):string - Parameter type added for parameter #2 (
$user):string - Parameter type added for parameter #3 (
$password):string - Parameter type added for parameter #4 (
$cursor_option):int - Parameter default value added for position #4 (
$cursor_option):SQL_CUR_USE_DRIVER
odbc_connect(
- $dsn,
+ string $dsn,
- $user,
+ string $user,
- $password,
+ string $password,
- $cursor_option
+ int $cursor_option = SQL_CUR_USE_DRIVER
) odbc_connect Function Availability
odbc_connect Function Availability| PHP Version | Availability |
|---|---|
| PHP 8.6Upcoming Release | Yes |
| PHP 8.5Supported (Latest) | Yes |
| PHP 8.4Supported | Yes |
| PHP 8.3Security-Fixes Only | Yes |
| PHP 8.2Security-Fixes Only | Yes |
| PHP 8.1Unsupported | Yes |
| PHP 8.0Unsupported | Yes |
| PHP 7.4Unsupported | Yes |
| PHP 7.3Unsupported | Yes |
| PHP 7.2Unsupported | Yes |
| PHP 7.1Unsupported | Yes |
| PHP 7.0Unsupported | Yes |
| PHP 5.6Unsupported | Yes |
| PHP 5.5Unsupported | Yes |
| PHP 5.4Unsupported | Yes |
| PHP 5.3Unsupported | Yes |