## Installation

### Can't connect to data source

by Jim Logan -
Number of replies: 2
We get the following error in the Apache2 error_log, and can't seem to fix the problem. Why is the data source null (''), even though we set the dsn for moodle and webwork databases in global.conf (below)? Moodle is working, and we can manually connect to the moodle and webwork databases.

[Wed Jun 04 14:34:32 2008] [error] [client 10.5.91.10] [/webwork2] Can't connect to data source '' because I can't work out what driver to use (it doesn't seem to contain a 'dbi:driver:' prefix and the DBI_DRIVER env var is not set) at /opt/webwork/webwork2/lib/WeBWorK/Authen/Moodle.pm line 165\n * in Carp::croak called at line 576 of /usr/lib/perl5/vendor_perl/5.8.8/i586-linux-thread-multi/DBI.pm\n * in DBI::connect called at line 543 of /usr/lib/perl5/vendor_perl/5.8.8/i586-linux-thread-multi/DBI.pm\n * in DBI::connect_cached called at line 165 of /opt/webwork/webwork2/lib/WeBWorK/Authen/Moodle.pm\n * in WeBWorK::Authen::Moodle::init_mdl_session called at line 50 of /opt/webwork/webwork2/lib/WeBWorK/Authen/Moodle.pm\n * in WeBWorK::Authen::Moodle::new called at line 272 of /opt/webwork/webwork2/lib/WeBWorK.pm

The following lines are from global.conf:

# these variables are used by database.conf. we define them here so that editing
# database.conf isn't necessary.
$database_dsn = "dbi:mysql:webwork";$database_username = "webworkWrite";
$database_password = "***";$database_debug = 0;

# Variables for sql_moodle database layout.
$moodle_dsn = "dbi:mysql:moodle";$moodle_table_prefix = "mdl_";
$moodle_username = "moodleuser";$moodle_password = "***";

We have also tried the following:
$database_dsn = "dbi:mysql:database=webwork;host=localhost";$moodle_dsn = "dbi:mysql:database=moodle;host=localhost";

Suggestions?

### Re: Can't connect to data source

by Jim Logan -
Problem solved by replacing missing authentication options lines in global.conf:

# Options for particular authentication modules

$authen{moodle_options} = { dsn =>$moodle_dsn,
username => $moodle_username, password =>$moodle_password,
table_prefix => $moodle_table_prefix, moodle17 =>$moodle17,
};

### Re: Can't connect to data source

by Michael Gage -
Jim,

Just for your information there are more recent versions of wwassignment available (that work with moodle 1.8 and moodle 1.9 respectively). These don't require that WeBWorK and moodle share the same database since they communicate using webservices instead of via database lookup. This means that the new versions of the wwassignment are less sensitive to changes in the database structure as new versions are created.

See

http://webwork.maa.org/wiki/Moodle_Assignment

for a description of wwassignment3 and wwassignment4 versions.