diff --git a/lib/dml/sqlsrv_native_moodle_database.php b/lib/dml/sqlsrv_native_moodle_database.php index 9521affb460ac..e145f1655ebfe 100644 --- a/lib/dml/sqlsrv_native_moodle_database.php +++ b/lib/dml/sqlsrv_native_moodle_database.php @@ -130,6 +130,11 @@ public function get_configuration_help() { * @throws dml_connection_exception if error */ public function connect($dbhost, $dbuser, $dbpass, $dbname, $prefix, array $dboptions=null) { + if ($prefix == '' and !$this->external) { + // Enforce prefixes for everybody but mysql. + throw new dml_exception('prefixcannotbeempty', $this->get_dbfamily()); + } + $driverstatus = $this->driver_installed(); if ($driverstatus !== true) {