As suggested in a previous thread, I have changed the $database_dsn string in global.conf to contain extra information about the host. Attempting to access any part of webwork that requires the database, however, gives me an error message:
error instantiating DB driver WeBWorK::DB::Driver::SQL for table set_user: DBI connect('database=webwork;host=oursite.com:3306','webworkWrite',...) failed: Can't connect to MySQL server on 'oursite.com' (13) at /opt/webwork/webwork2/lib/WeBWorK/DB/Driver/SQL.pm line 65
at /opt/webwork/webwork2/lib/WeBWorK.pm line 286
I can connect successfully to the database using the MySQL CLI, so I know it's accesible and I've gotten the proper permissions set.
I poked into SQL.pm to see what's happening at line 65, and tried replicating it in a Perl REPL, with success. Just to be extra-sure, I yank-putted it into a separate file, added the appropriate dsn/user/pass information, and ran it, also with success. Here are its contents:
use DBI;
$source = "dbi:mysql:database=webwork;host=oursite.com:3306";
$username = "webworkWrite";
$password = "asupersecretpassword";
$handle = DBI->connect_cached(
$source,
$username,
$password,
{
PrintError => 0,
RaiseError => 1,
},
);
die $DBI::errstr unless defined $handle;
$source = "dbi:mysql:database=webwork;host=oursite.com:3306";
$username = "webworkWrite";
$password = "asupersecretpassword";
$handle = DBI->connect_cached(
$source,
$username,
$password,
{
PrintError => 0,
RaiseError => 1,
},
);
die $DBI::errstr unless defined $handle;
I am a bit puzzled as to why this connects just fine while running practically the same code in webwork produces an error. Yes, I have triple-checked that the dsn, username and password all match between global.conf and this file.
Any ideas on why this isn't working? Alternatively, I'll take suggestions on how to tackle the problem - in Python, I'd probably drop into pdb in that subroutine and poke around a bit, but I'm not too familiar with Perl's development tools.