External DB Auth and Enrol with SQL Server

External DB Auth and Enrol with SQL Server

by Clayton Smith -
Number of replies: 1

Hello,

I have been trying for an eternity to get external database authentication working with a SQL database.

Moodle (latest version) runs just fine on SQL Server 2008 R2 with it's database that the install builds (sqlsrv)

Our existing system has it's own database for user accounts so obviously I need to use the external DB Auth plugin.

I saw on other posts that the plugin does not include the DB type that I need to do this with the SQL Server Driver for PHP which the post specified as "mssqlnative" and that I would need to modify the config to add it to the list - Done.  Also added "sqlsrv" just for the heck of it.

It appears that these external database plugins connect very differently that the install config does which just "knows what to do" and the settings for the plugins don't seem to match the installs settings and it doesn't even look like it works the same way.  Am I correct in that these plugins are out of date?

The error I get tells me that there are core connection files that do not support the connection settings in the plugin:

(mssqlnative): SELECT * FROM Employees WHERE Email = 'xxxxx@xxxxx.org' AND Password = 'xxxxxxxxxxxx' 
(mssqlnative): SELECT Email AS username FROM Employees WHERE Email = 'xxxxxx@xxxxxx.org'
Notice: Trying to get property of non-object in E:\Paec_org\Moodle\lib\adodb\adodb.inc.php on line 3595
 Notice: Undefined index: in E:\Paec_org\Moodle\lib\adodb\adodb.inc.php on line 3999 Notice: Undefined index: in E:\Paec_org\Moodle\lib\adodb\adodb.inc.php on line 4000
 Fatal error: Cannot access empty property in E:\Paec_org\Moodle\lib\adodb\adodb.inc.php on line 3607 
Fatal error: sqlsrv_warnings contains an invalid type in E:\Paec_org\Moodle\lib\dml\sqlsrv_native_moodle_database.php on line 358
 Fatal error: sqlsrv_warnings contains an invalid type in E:\Paec_org\Moodle\lib\dml\sqlsrv_native_moodle_database.php on line 1312

"Functional Database Tests" when you specify in the config another database to test never work either.  The only connection that ever works is the one created in the install process.

I have tried everything, this makes no sense at all.  Any help would be greatly appreciated.

Average of ratings: -
In reply to Clayton Smith

Re: External DB Auth and Enrol with SQL Server

by Lisa Nicholls -

I had similar problems.  I agree with you that the plugin seems to be somewhat out of date. I don't know if it is absolutely necessary, but I can tell you what I did to get it to work:

* -- created an ODBC System DSN on the moodle web tier server to point at the database server, which I don't use for anything except these plugins

* -- Use the DSN name in the Host configuration option, not the server name

* -- use odbc_mssql as the database type from the drop down

* -- I have "no" for sybase quotes in spite of the comment in the dialog.  Your mileage may vary.

... if this doesn't work for you, be careful that you've set up the DSN in the proper version of the odbc admin (IOW, even though the system is 64 bit you may have to use a 32 bit DSN) -- you'll probably know this is the problem by the error messages you get when you have Debug ADOdb turned on.

Once this seemed to be a respectable path to success, at least for now (I hope to be able to change it later) I also used the same strategy for the enrolment plugin.  Don't know if you'll see the same issues there.

HTH,

>L<

 

... after this was working properly