Installing and upgrading help

MS SQL Server instance

 
Picture of Tim Djossou
MS SQL Server instance
 

I am using 3.3.2+ (Build: 20170928) with SQL Server and PHP 7.0.21

Moodle was originally installed and is using an SQL Server database My-Company-SQL 

Because I am developing and testing, I have copied the database to our test SQL server My-Company-SQL \test

I would like the current Moodle to use the new database.

However when I edit the file config.php (at the root of moodle) and change 

$CFG->dbhost    = 'My-Company-SQL';

to

$CFG->dbhost    = 'My-Company-SQL\test';


there is no difference. I go to site administration>server>environment  the database item on the page still shows the old database and any new operation (course, user, etc..) is commited to the old database

Have I missed a configuration item ?

Could you please help ?

 
Average of ratings: -
Picture of Leon Stringer
Re: MS SQL Server instance
Particularly helpful Moodlers

So both SQL Server instances are running on the same server, My-Company-SQL?

Have you got a port specified in config.php? It may be that this is overriding the instance name so you could try commenting that out.

Just a suggestion: maybe change the password of the SQL Server user account on the test instance to prevent connecting when you don't expect to. You never want to be "accidentally" modifying a database different to the one you're expecting!

 
Average of ratings: -
Picture of Tim Djossou
Re: MS SQL Server instance
 

Thank you Leon for looking into that.

my original config.php had this line for the port 

$CFG->dboptions = array (  'dbpersist' => 0,  'dbport' => 1433,  'dbsocket' => '',);

I modified it to 

$CFG->dboptions = array (  'dbpersist' => 0,  'dbsocket' => '',);

I also set the dbhost  to the test server

I received the following reply from the server 

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


Did I modify the dboptions correctly?

Any other idea?

Regards

Tim

 
Average of ratings: -
Picture of Leon Stringer
Re: MS SQL Server instance
Particularly helpful Moodlers

Check the event log on the server hosting the test instance to see if anything is reported. You could also check the account Moodle is using on the SQL Server test instance by using SQL Server Management Studio to connect to the test instance but instead of using pass-through authentication use SQL Server authentication and enter the username and password specified in $CFG->dbuser and $CFG->dbpass. (If you've backed up and restored, or copied the database, the SQL Server user account Moodle is using may not have the expected privileges on the test instance).

 
Average of ratings: -