Moodle 2.0 RC1 external database enrolment: not creating courses

Moodle 2.0 RC1 external database enrolment: not creating courses

by Steve Anatai -
Number of replies: 13
Hi,

Testing Moodle 2.0 RC1 and I cannot get courses to auto-create when a user logs on. I'm using the external database enrolment plugin and a custom view in an external MSSQL database (SIMS) which has worked flawlessly with Moodle 1.9.

I have filled out all the fields under "Creation of new courses". It seems that the plugin is trying to assign roles to courses but is giving up as they don't exist yet. If I manually create the course the roles are assigned correctly.

Has the default behaviour in Moodle 2.0 changed so that courses are not auto-created when a user logs on? I've checked the database view to ensure it's returning the correct fields; SQL server logs show that Moodle is running the query against it.

Any help appreciated!

Steve
Average of ratings: -
In reply to Steve Anatai

Re: Moodle 2.0 RC1 external database enrolment: not creating courses

by Steve Anatai -
Sync script in enrol/database/cli does create all the courses from the MIS but not out of the box. I had to make some modifications to the lib; see attached patch. I don't really know what other effects these modifications have, if any, but they work for my project.
In reply to Steve Anatai

Re: Moodle 2.0 RC1 external database enrolment: not creating courses

by Deleted user -

Hi

I got the same problem. I tried your patch but no luck.

 

I have 3 tables;

1- courses table which store the courses fields are: lesson (as long name) code (as shortname) idnumber (as idnumber) category and template

 

2- users table ( to authenticate users from an external database) this one works fine and add users to moodle when they log in.

 

3- user course role table. I have fields username(user name of the user ) idnumber( id number of the course) and role (student or teacher)

I mapped the fields, i run the cron but no error given and also no data is written. I do not know what to do. Your help is really appreciated.

 

regards

 

Zulfi

In reply to Deleted user

Re: Moodle 2.0 RC1 external database enrolment: not creating courses

by Janet Smith -

I just installed Moodle 2.0.2. I am using the External Database Enrollment Plugin to connect to an external MSSQL database. My Moodle is running on MySQL. It isn't working. The error log and debugging both show nothing.

I see there have been some bug reports with this feature but they claim to have been fixed in 2.0.1. My findings in testing are that this feature still isn't working. Classes are not getting created and enrollments are not being updated as they were when running 1.9.x. I used the same settings for the configuration of the plugin that works in 1.9.x without a problem.

Are there additional open trackers related to this feature? Has anyone had similar experiences? I am quite concerned that this feature isn't working.

In reply to Janet Smith

Re: Moodle 2.0 RC1 external database enrolment: not creating courses

by Steve G -

I've been banging my head against this problem for hours:

Moodle 2.0.2, External Enrolment to an Oracle Database.

Doesn't work.  I can't even get it to show any errors or debug information.  Even if I purposely put bad database connection strings or information, no errors when a user logs in.

In reply to Steve G

Re: Moodle 2.0 RC1 external database enrolment: not creating courses

by Steve G -

I was able to resolve my specific situation:

  • Oracle 11.2.0.1.0
  • OCI8 Oracle Client Install 11.1
  • Moodle 2.0.2+ 20110303
  • External Enrolment would not insert role assignments nor user enrolments

What I did to fix the problem:

  • Modified moodle\enrol\database\lib.php
  • replaced all occurences of "strtolower" with "strtoupper"

I guess this external database wants to work with field names in all upper case, not all lower case (at least for fetching the data by column name).

In reply to Steve G

Re: Moodle 2.0 RC1 external database enrolment: not creating courses

by Ronald Ong -

I have the same problem on external databse enrolment using:
- Postgresql 9.02 external enrolment db
- Moodle 2.0.2+ (Build: 20110413)
- All Course ID are UPPERCASE (external db)
- enable external db enrolment plugin before creating new courses.

i tried to upgrade latest moodle version and create new courses but it always fails to add enrolment method using external db on all courses.

I open course enrolment method settings but i can not add external db enrolment - no listing, even i already setup external database plugin)

I manage to successfully sync the external enrolment by manually adding 1 record to mdl_enrol table. Add "database" enrolment method per course.

After adding 1 record per course, run sync.php (/enrol/database/cli/) on the server, then it will add records to user enrolment table.

 

In reply to Ronald Ong

Re: Moodle 2.0 RC1 external database enrolment: not creating courses

by Janice Johnson -

Hi Everyone,

I have been unable to resolve this issue with the external database authentication and enrollment.

If anyone that had resolved this issue is available to walk me through the process, I would gladly pay. I host Moodle 2.0.2+ (Build: 20110413) on GoDaddy with Linux and PHP 5.2. 

You all know my frustration, so any help would be greatly appreciated.

 

Thanks,

Janice

In reply to Steve Anatai

Re: Moodle 2.0 RC1 external database enrolment: not creating courses

by Lewis Carr -

I too am experiencing problems with external database enrolments.
I have a working ODBC connecton to a MSSQL database, I have tested this with a simple PHP connection/query running on the same server and the script can query the database server.

All worked well under 1.9 but with Moodle 2 no enrolments take place.  No error messages or anything when debugging is on.

I am also installing a new Moodle 2.0 at another organisation and experiencing the same issues.

I've been working on this for 4 days solid.  Has anyone made any progress on this? 

In reply to Lewis Carr

Re: Moodle 2.0 RC1 external database enrolment: not creating courses

by Lewis Carr -

OK so I've got a little further, but still not working.

(Moodle 2 running on Windows 2008 Server, IIS, MySQL) communicating with an MSSQL database via a Windows ODBC connection.

I have concluded that Moodle 2.0.2+ (Build: 20110406) does not perform external database enrolments at login or by visiting the Mymoodle page, as per Moodle 1.9.

The cron also fails to trigger the enrolment script, the only way I can trigger external DD enrolments is to run the cli/sync.php script.

When this is triggered, nothing happens.

I have tried the following:

  • replacing all occurences of "strtolower" with "strtoupper"
  • and vice versa
  • adding a manual entry to mdl_enrol then running cli/sync.php
  • I have tested with mySQL driver and mysql database locally and this works, not for logins but at least through running the sync script
  • made sure that the MSSQL client is installed on the webserver - this is needed.

I know the ODBC connection is working as I can connect to it using a simple PHP page on the server and query the tables.  So I know the usernames, passwords and hosts are correct.  I have triple checked the field names.

I had this working perfectly on 1.9.

 

In reply to Lewis Carr

Re: Moodle 2.0 RC1 external database enrolment: not creating courses

by Lewis Carr -

In the end I had to resort to installing the FREETBS driver for MSSQL.  This worked fine.  So now enrolments are done by talking directly to the MSSQL database.

Not what I wanted.

This is one of those problems where there are so many factors that could be causing problems, such as PHP Version, IIS, Apache, MSSQL Version etc...

But for now I'm avoiding ODBC and going direct to the source and it works.

Average of ratings: Useful (1)
In reply to Lewis Carr

Re: Moodle 2.0 RC1 external database enrolment: not creating courses

by Rob Duncan -

I am also concerned about this plugin, honestly it worked better in 1.9

I am now getting

Notice: Undefined property: stdClass::$fullname ....../enrol/database/lib.php on line 281

which is around here

 // create roles mapping
        $allroles = get_all_roles();
        if (!isset($allroles[$defaultrole])) {
            $defaultrole = 0;
        }
        $roles = array();
        foreach ($allroles as $role) {
            $roles[$role->$localrolefield] = $role->id;
        }

Thing is enrolments are working and all my DB records and mapping looks fine (otherwise it wouldn't work at all I'm guessing)

I'm using ldap enrolment and do ldap sync.php first

also enrol_database_sync.php used to output someuseful information in regard to enrolments that cron used to mail to me, sync.php has no output it seems except for error.

 

I'm using MySQL on the same server

all software was downloaded from a yum repo last month

thanks

Rob.

 





In reply to Lewis Carr

Re: Moodle 2.0 RC1 external database enrolment: not creating courses

by oneil clacken -

I am still unable to create courses from an external source.

1. I have moodle 2.04 installed on a Windows 2008 server(VM

2. I have the external SQL Server database on another windows box

3. If I create a course in moodle with the same idnumber as the course in  the SQL server "course table", the student will be enrolled in the course. If the course does not exist in moodle, I was HOPING it would create it! But, it doesn't mixed. Any assistant would be great! 

btw, I tryed all of the above, including the patch and the strtoupper....

In reply to oneil clacken

Re: Moodle 2.0 RC1 external database enrolment: not creating courses

by Guillermo Ramirez -

Hi, I had the the same problem, in my case it were some simbols in the data in the  table,

My data is in spanish so some symbols like é á ñ... cannot be recongnized by Moodle or PHP o MySQL, i'm not sure, but replacing that symbols it works fine.

sorry for my english