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

add support for PDO databases in auth_db

    XMLWordPrintable

Details

    • MOODLE_33_STABLE
    • MOODLE_33_STABLE
    • master
    • Easy
    • Hide

      Pre-requisite: PDO-compatible DB server; PHP compiled with a PDO DB extension

      1. Set up external DB auth with your PDO-compatible server, and use the "pdo" option for connection.
      2. Ensure you can log in and all information is loaded as expected.
      3. Set up external DB enrolment against the same PDO option.
      4. Ensure users are enrolled as expected.
      Show
      Pre-requisite: PDO-compatible DB server; PHP compiled with a PDO DB extension Set up external DB auth with your PDO-compatible server, and use the "pdo" option for connection. Ensure you can log in and all information is loaded as expected. Set up external DB enrolment against the same PDO option. Ensure users are enrolled as expected.

    Description

      We have an azure database that we want to use as a source of our users.

      The sqlsrv driver by microsoft is now available for both linux and windows so it's no longer only windows servers that can connect with azure or sql server through this driver.

      I noticed the external database auth plugin uses adodb in the background, adodb already has support for pdo_sqlsrv so it's mostly a matter of changing the settings form to allow you to select this driver.

      I've tested it out myself with moodle 3.2.1 by hardcoding some changes in /auth/db/auth.php

      change line 159 to: $authdb = ADONewConnection('PDO');
      change line 164 to: $authdb->Connect('sqlsrv:server=SERVERNAME;database=DATABASENAME', $this->config->user, $this->config->pass);

      Everything seemed to work without problems with this hardcoded version. I suppose the biggest issue is the fact that the connection string through PDO looks very different from the currently supported database types. Which makes it more work to add this then simply expanding the options list with one extra option.

      Attachments

        Issue Links

          Activity

            People

              knys Koen Nys
              knys Koen Nys
              Juan Leyva Juan Leyva
              Andrew Lyons Andrew Lyons
              Ryan Wyllie Ryan Wyllie
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                15/May/17