Windows database issues

Windows database issues

by Bill Lang -
Number of replies: 3
Yes, I'm doing a full Moodle install, using MS SQL and IIS.  Don't blame me, I just work here.  Anyway, I successfully installed Moodle, PHP and everything else to get this to work on my server.  Moode / PHP is on one server and the database resides on a separate server.  I have the database connection using ODBC.  Everything works locally, I can add users, courses, etc... without problems, (using http://localhost) but when I try to run Moodle from another machine on our network (using http://servername), I get an error saying, "

Error: Database connection failed.

It is possible that the database is overloaded or otherwise not running properly.

The site administrator should also check that the database details have been correctly specified in config.php

Config.php contains:


$CFG->dbtype    = 'odbc_mssql';
$CFG->dbhost    = 'cscrs';
$CFG->dbname    = '';
$CFG->dbuser    = 'moodle';
$CFG->dbpass    = 'moodleuser';
$CFG->dbpersist =  false;
$CFG->prefix    = 'mdl_';

So, I'm confused.  Everything works on the local server, but I don't understand why I can't get Moodle to work anywhere else on our network, which effectively makes it useless.  I've spent the last 2 days searching the internet and can't find anything regarding this issue that is relavent to MS SQL.  I'm suspecting this is some kind of permission issue within IIS, but I don't know where to begin.

I've tried to add as much detail in the question as possible, but if I left anything out, let me know.

Thanks for any replies...

Bill.

Average of ratings: -
In reply to Bill Lang

Re: Windows database issues

by Chris Lamb -

Just a thought, before you get too hung up on it being a database problem check some basics - the usual reason why a Moodle will work on the server but not on any other machine is because some other settings in config.php are pointing to localhost or a relative path rather than the full path to the server.  Check $CFG->wwwroot and $CFG->dirroot to make sure they're pointing to the right place.

Might also be worth seeing if MS SQL keeps log files, or if it can be told to.  The log files might tell you exactly what's going wrong (eg "Couldn't find xxx" or "Couldn't open xxx"), which might point you in the right direction.  You could also turn on or increase Moodle's debugging facility, which might tell you exactly what it failed to do.

HTH

Chris

In reply to Chris Lamb

Re: Windows database issues

by Bill Lang -

Well, the rest of the config.php contains:

$CFG->wwwroot   = 'http://localhost';
$CFG->dirroot   = 'C:\Inetpub\wwwroot';
$CFG->dataroot  = 'C:\Inetpub\moodledata';
$CFG->admin     = 'admin';

I can see the dataroot tag is pointing somewhere in the inetpub directory, maybe that should be pointing to the ODBC connection?  Not sure...  But that c:\inetpub\moddledata directory is empty on the server.  Don't know if it's supposed to be or not.

I will search for some log files to see if they contain anything useful.

Thanks for the response...

Bill.

In reply to Bill Lang

Re: Windows database issues

by Richard Enison -
BL,

No, dirroot and dataroot are fine. Dataroot is supposed to point to a folder, as it does, not a database. But there's a BIG problem with wwwroot. I'm not sure why this would cause a database connection problem offhand, but if you're going to access the Moodle site from another computer, localhost will not work as a URL for your main Moodle folder. If anything it would probably be interpreted as the document root of whatever web server is running on the machine the browser is running on. If there is no web server running on that machine, it would result in a "Server not found" error. You need to replace localhost with a URL that makes sense from the point of view of other computers in your network, from which you wish your Moodle site to be accessible.

RLE