Database ODBC Driver
ODBC connection backend, generic runtime driver and conservative schema grammar.
Provider responsibility
OdbcDatabaseServiceProvider registers OdbcConnection, OdbcDatabaseDriver, ODBC identifier/sql escapers and OdbcSchemaGrammar. It also registers the odbc driver and odbc schema grammar factories in DatabaseDriverRegistry.
Configuration
Use driver odbc for ODBC connections. DSN can point to a configured ODBC data source or use a backend-specific connection string accepted by the PHP ODBC extension.
DB_DRIVER=odbc
DB_DIALECT=odbc
DB_DSN=DSN=example
DB_USER=user
DB_PASS=secret
DB_PERSISTENT=false
Runtime API
ODBC runtime is available through Database, DatabaseDriverInterface and QueryBuilder. It supports query execution, cursor streaming, affected rows, insert id when the backend provides it, escaping, identifier protection, platform/version and transaction methods.
Schema grammar
OdbcSchemaGrammar is conservative because ODBC is an access layer, not a single SQL dialect. Basic tables, columns, indexes and foreign key SQL can be compiled, but concrete support depends on the ODBC target backend.
Portability limits
Do not assume MySQL-specific syntax such as INSERT IGNORE, ON DUPLICATE KEY UPDATE, FOR UPDATE or LOCK IN SHARE MODE works through every ODBC target. Test generated queries and schema operations against the actual backend.
Insert id note
Some ODBC backends do not expose a generated insert id. Model::insert() can return 0 after a successful insert when affected rows indicate success but lastInsertId() is unavailable.