in reply to What is the proper data structure for CAP::DBH?
You say: DBI docs suggest this format for the data structure
$data_source = dbi:DriverName:database=database_name;host=hostnameSo, I have set up the connection to look like this:
my $data_source = 'DBI:mysql:'. $self->config_param('mysql.database').':'. $self->config_param('mysql.host');
However the first part suggests it should rather look like this (note also the semicolon in the string):
my $data_source = 'DBI:mysql:database='. $self->config_param('mysql.database').';host='. $self->config_param('mysql.host');
So maybe you should try that first.
In fact I'd probably prefer to construct a string like that with sprintf:
my $data_source = sprintf 'DBI:mysql:database=%s;host=%s', $self->config_param('mysql.database'), $self->config_param('mysql.host');
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: What is the proper data structure for CAP::DBH?
by bradcathey (Prior) on Jan 18, 2023 at 13:44 UTC | |
by hippo (Archbishop) on Jan 18, 2023 at 13:53 UTC | |
by bradcathey (Prior) on Jan 18, 2023 at 20:04 UTC | |
by kcott (Archbishop) on Jan 18, 2023 at 21:25 UTC |