On this page
Writing database drivers
Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites
PDO
Drupal 7 uses PDO (Php Data Objects) to access databases. You can find more information here: https://www.drupal.org/node/549702
Allowing prefetch in a custom database driver
If you use a third-party database driver that makes use of the DatabaseStatementPrefetch class, you may need to allow-list the driver by adding it to a variable.
Drupal core's own database drivers (and the contrib sqlsrv driver) do not require additional configuration. The contrib Oracle driver is allow-listed by default.
Example for settings.php:
$conf['database_statement_prefetch_valid_db_drivers'] = array('mydbdriver');
In addition, if a 3rd party database driver uses the DatabaseStatementPrefetch class it must now include the source file directly (as opposed to relying on autoloading). Again Drupal core's own database drivers, and the contrib Oracle driver already do this.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion
Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.