Enrol_DB Cannot Make a Connection

Enrol_DB Cannot Make a Connection

by Scott Riggs -
Number of replies: 4

I have been trying for the past two weeks to get Moodle to enroll students using an external database.  The external database is on the same server that Moodle is on.  The external database is a MySQL database.  I have tried everything I can think of and I continuously get the following error message: [ENROL_DB] Could not make a connection.  All of the students and student ID numbers have been uploaded into Moodle.  Many of the course ID #s have been entered as well (I would like Moodle to autocreate the remaining course ID #s that have not been entered).  I have tried logging in as students after updating the configuration for the external database settings using all the various possible settings I can think of, and all my students still remain unenrolled.  I have also tried running the enrolment syncing cron job to have the enrolments synced, but it did not enroll anyone.  I have read through all the forum posts that I could find related to this issue and have yet to find anything that works. 

Here are my current settings:

enrol_dbtype:  mysql

enrol_dbhost:  (I have a shared IP address, so I put that here)

enrol_dbuser:  (Here, I entered my username that is needed to log on to the server)

enrol_dbpassword: (Here, I entered the password used to log on to my server)

enrol_dbname: (the name of my database)

enrol_dbtable: Moodle_UserCourses

enrol_localcoursefield:  idnumber

enrol_localuserfield:  idnumber

enrol_db_localrolefield: shortname

enrol_remotecoursefield: idnumber

enrol_remoteuserfield:  username

enrol_db_remoterolefield:  role

And then autocreate is turned on and is set to place classes in a category called "Unassigned".

I can supply additional information; I am just not sure what information is needed.  I am by no means a computer expert, so I'd greatly appreciate whatever help you could offer.

Thanks,
Scott

Average of ratings: -
In reply to Scott Riggs

Re: Enrol_DB Cannot Make a Connection

by Richard Standen -
If the database is on the same server as Moodle, then enrol_dbhost should probably be localhost.

I haven't looked thru any of your other settings properly - but I'd certainly try switching enrol_dbhost.

Regards

Richard
www.coursemerchant.com
richard@connectedshopping.com
In reply to Richard Standen

Re: Enrol_DB Cannot Make a Connection

by Scott Riggs -

Hi Richard,

Thanks so much for the response.  I tried setting enrol_dbhost as "localhost".  I have also tried setting enrol_dbuser with the user for the mysql database and enrol_dbpassword with the password for the database (instead of the user and password for the server).  None of this seems to work.  When I log on as a student, he/she still remains unenrolled.

Any ideas?

Thanks,

Scott

In reply to Scott Riggs

Re: Enrol_DB Cannot Make a Connection

by Richard Standen -
If you email me at richard@coursemerchant.com I will send you login details of a working Moodle install plus a view of the external enrollment table. You can then look at our field mappings and try to see where you've gone wrong.

Unfortunately, it won't be this evening - I'm about to log off for the night. But I'll do it early tomorrow.

Richard
In reply to Richard Standen

Re: Enrol_DB Cannot Make a Connection

by Richard Standen -
BTW - the user and password you shld be entering are definitely meant to be the database ones - not your server access ones.

Richard