Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-44377

dmlreadexception when installing on MSSQL without table prefix

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.5.5, 2.6.2
    • 2.5.4, 2.6.1, 2.7
    • Installation
    • MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE
    • MOODLE_25_STABLE, MOODLE_26_STABLE
    • Hide

      1) Use a default config.php file, using the sqlsrv driver, and set $CFG->prefix to '' (empty string).

      2) Try to access to any Moodle page with the settings above, an immediate error should be shown: "Error: database table prefix cannot be empty (mssql)" not allowing the application to go anywhere beyond that.

      3) Set a non empty $CFG->prefix value and visit the site again. Now it will work with normality (installation will be triggered if the site is new or normal pages will work if the site already existed).

      4) Run unit tests for sqlsrv, no problems should appear related with this issue.

      Show
      1) Use a default config.php file, using the sqlsrv driver, and set $CFG->prefix to '' (empty string). 2) Try to access to any Moodle page with the settings above, an immediate error should be shown: "Error: database table prefix cannot be empty (mssql)" not allowing the application to go anywhere beyond that. 3) Set a non empty $CFG->prefix value and visit the site again. Now it will work with normality (installation will be triggered if the site is new or normal pages will work if the site already existed). 4) Run unit tests for sqlsrv, no problems should appear related with this issue.

      The following exception occurs when using the web installer, configured with MSSQL without a table prefix. I believe the issue is because "User" is a reserved word in MSSQL and must be escaped (if that is the proper way to say it) using square brackets: [User].

      Message: [Microsoft][SQL Server Native Client 11.0][SQL Server]Incorrect syntax near the keyword 'user'.<br>
       
      SELECT TOP 1 'x' FROM user 
      [array (
      )] 
      Error code: dmlreadexception
      

      I was able to work around this by: dumping the database, updating the config.php file to include a table prefix, and re-installing.

            stronk7 Eloy Lafuente (stronk7)
            blove@webucator.com Brian Love
            Petr Skoda Petr Skoda
            Dan Poltawski Dan Poltawski
            Michael de Raadt Michael de Raadt
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.