Connecting to an external ODBC database

Connecting to an external ODBC database

by Ron Wright -
Number of replies: 4

My real issue is with external database authentication but I have not found anyone that could assist and as the external enrollments plugin calls the same libraries for database connectivity I though I would ask here as well.  When selecting ODBC as the database type I would assume based upon looking at the code that I must feed it a DSN somehow.  The current forms don't appear to support this although ODBC is a connection type.  My example below is an error returned from the authentication plugin debug code but should be similarly applicatable here due to the shared libraries.  This is with moodle 1.8x.  I have written a short php script that connects to this same DSN directly and accesses the data so I know the basics are setup right.  It's just how do I pass the appropriate DSN through the setup screens?

I am attempting to setup authentication to an external database (Informix) using an odbc connection.  When I setup the connection and turn on debugging I receive the following error:

For odbc Connect(), dsn=CX is not used. Place dsn in 1st parameter.
172.20.16.66: Connection error to server '172.20.16.66' with user 'bogususer'

Moodle is running on a windows server on which I have defined a System DSN named 'CX'.  Where do I tell the external authentication setup to use this DSN.  It definately does not like it in the database name field as I receive the error above.


I connect to this external Informix database via odbc through numerous other sources so I know connectiviity is their.  I just need to get moodle/php configured properly.

Any and all help is greatly appreciated!

--Ron

Average of ratings: -
In reply to Ron Wright

Re: Connecting to an external ODBC database

by Andrea Gregory (Gordon) -

Hi Ron,

I think you put it in the dbhost. Try it and see...

Andrea

In reply to Andrea Gregory (Gordon)

Re: Connecting to an external ODBC database

by Ron Wright -

Andrea,

You are AWESOME!  I placed the DSN name in the HOST field and left the database name blank.  I still had an error after this but it was related to DB permissions on my view.  Fixed the perms and all appears good now!

Thanks again!

--Ron

In reply to Ron Wright

Re: Connecting to an external ODBC database

by Andrea Gregory (Gordon) -
That's great news Ron! smile Don't ya just love it when your advice makes someones day! smile Glad I could be of help...
In reply to Andrea Gregory (Gordon)

Re: Connecting to an external ODBC database

by Stanley Swank II -

I am having a similar issue.  Can someone tell me the exact syntax for the dsn and where exactly to place it?

 

Thank You