You can use an external database to control student enrollment. In this case, Moodle looks in the designated database and determines whether the student is enrolled.
In addition to using the external database, you can also allow Moodle's normal enrollment routine. If you enable manual enrollments in addition to the external database, Moodle checks two databases when a student tries to enter a course: the external one and its internal one.