Using Oracle with database enrolment

Using Oracle with database enrolment

by Owen Stephens -
Number of replies: 14
I'm trying to setup the database enrolment method with Oracle (9). Unfortunately I'm not getting very far at the moment.

Can anyone suggest:
Any pre-requisites for this (do I need to have an Oracle client installed to use the oci8 connection?)
Debugging - best method for debugging the connection

Has anyone got this working (Moodle 1.5.3).

Thanks
Average of ratings: -
In reply to Owen Stephens

Re: Using Oracle with database enrolment

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
As far as I remember, yes, you need the Oracle client installed.

The other only thing I remember is that oci8 PHP extension clashed with LDAP PHP extension (at least it did in my Debian GNU/Linux setup) so beware smile

Saludos. Iñaki.
In reply to Iñaki Arenaza

Re: Using Oracle with database enrolment

by Owen Stephens -
Thanks for this.

We are also using Debian - did you manage to get round the clash of php extensions?
What Oracle client did you use?  (doesn't look like there is one specifically for Debian?)

Cheers,

Owen
In reply to Owen Stephens

Re: Using Oracle with database enrolment

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Nope, I couldn't get round it, so I finally decided to use an intermediate mysql database. From my Oracle box (running in W2K, using PHP scripts) I push all the data to a MySQL database and Moodle takes its data from this MySQL database.

I know this is less than ideal, but I gave up after a couple of weeks trying to compile the oci8 extension and ldap extension together. It seems OCI8 includes its own LDAP support and some of the functions are named exactly like the OpenLDAP ones, and the linker would choose sometimes de OCI8 ones, and sometimes de OpenLDAP ones, so I ended with a (non-woking) mix.

I used the Oracle 10g Instant Client (or something like that, I can't remember exactly).

Saludos. Iñaki.
In reply to Iñaki Arenaza

Re: Using Oracle with database enrolment

by James Dugal -
!Hola Iñaki!  I'm a fan of your database enrolment mods for 1.5.x and I was wondering if they have been, or will be, ported to Moodle 1.6?  I've made a few further mods for 1.5.4, such as controlling the verbosity, and auto-enrolling users in Moodle when necessary (and the information needed is available).
--James Dugal

(please discúlpame del off-topic reply)
In reply to James Dugal

Re: Using Oracle with database enrolment

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Hola James smile

they have not been ported to 1.6 mainly because I thought no-one was using them, and partialy because I've had some health problems in the last 3 months (but I'm much better now, thank you wink)

They should be easily portable to 1.6, and I'll be doing this in a couple of weeks or so (I'm a bit busy right now).

If you think your mods would be interesting to others, we could try and merge them too.

Saludos. Iñaki.
In reply to Iñaki Arenaza

Re: Using Oracle with database enrolment

by James Dugal -
OK, I will attach a zipfile showing my meager mods!  Have fun!
--James
In reply to James Dugal

Re: Using Oracle with database enrolment

by Owen Stephens -
Where is the original mods (and documentation?) which you have adapted for this?

Thanks,

Owen
In reply to Iñaki Arenaza

Re: Using Oracle with database enrolment

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
They should be easily portable to 1.6, and I'll be doing this in a couple of weeks or so (I'm a bit busy right now).

Yup! This has been easier than I thought smile I already did it back in February when I developed the patch for the 1.5.3 series and nothing has changed in 1.6 since february in the enrolment code.

So the patch is basically the same. I have put it at:

http://orodruin.escomposlinux.org/~iarenaza/moodle/enrol_database_moodle_16_20060622.diff.gz

I'll provide  patches for 1.5.4 in a couple of days (I just need to verify nothing has fundamentally changed between 1.5.3 and 1.5.4 in the enrolment database plugin).

I'll cook a second patch with your mods too, btw smile

Saludos. Iñaki.
In reply to Iñaki Arenaza

Re: Using Oracle with database enrolment

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Don't use the above patch, it's broken (I did it using the wrong CVS tree).

I have uploaded a new one that applies cleanly to 1.6 and Works(tm) smile

The new (working) one is:

http://orodruin.escomposlinux.org/~iarenaza/moodle/enrol_database_moodle_16_20060703.diff.gz

Saludos. Iñaki.
In reply to Iñaki Arenaza

Re: Using Oracle with database enrolment

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Just a quick note to say that I removed all the old files referenced above. If you want the most current patches, you can get them at:

http://orodruin.escomposlinux.org/~iarenaza/moodle/enrol_db_patch_series_for_16/

If you want complete files, you can get them at:

http://orodruin.escomposlinux.org/~iarenaza/moodle/enrol_db_files_for_16/

If you want any of these for 1.5.x, just drop me an email at iarenuno (at) eteo (dot) mondragon (dot) edu.

Saludos. Iñaki.

In reply to Iñaki Arenaza

Re: Using Oracle with database enrolment

by James Dugal -
Iñaki, I just discovered a problem in the 1.5.4 version of your mods, when it is trying to unenrol students whose course is no longer listed in the external DB.  The problem seems to be that I get no hits from the query.  This query (just after the comment
//prune enrolments to courses that are no longer in ext auth
) has perhaps 3400 courses in the $extcourses string, and hence included in the generated sql after:  NOT IN (...).  I am getting no error indication anywhere I looked (screen, Apache error log, and Mysql err log) but I suspect this query may be too big?  I am using MySQL 5.0.22 with my.cnf copied from my-large.cnf.  Any comments?  Guess I could try the huge my.cnf if the critical buffer size is addressed in the default my.cnf....--James
In reply to James Dugal

Re: Using Oracle with database enrolment

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
What's the size of your max_allowed_packet variable in MySQL?

Saludos. Iñaki.
In reply to Iñaki Arenaza

Re: Using Oracle with database enrolment

by James Dugal -
I ran 'mysqladmin variables' ... looks like max_allowed_packet is set to 1047552. And the sql query is about 58000 bytes long. I'm puzzled! Could some adodb limit be encountered? Not having any indication of error bothers me! --James
In reply to James Dugal

Re: Using Oracle with database enrolment

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Adobdb is pure PHP and uses the normal PHP database extensions (mysql in your case), so I don't think imposes any further limits per se.

I'd say that having max_allowed_packet to 1 MB is quite low for the type of usage you have with Moodle. I have mine set to 16 MB. You could try setting it to that value and see if it fixes the issue, before starging looking elsewhere.

Saludos. Iñaki.