Hello
Environment
Debian 2.6.26-2-686 / Perl 5.10.0
Question CGI/CRUD - and its encapsulation of DBI using their DBIx::Knowledge
http://www.thesmbexchange.com/smartcruddy/index.html
I can see from the apache2 logs that my httpd.conf variables DBI_DSN DBI_USER
DBI_PASS being processed correctly.
However, my host Oracle database is only accessible via port 1524 (our
Network admin is strict).
The default Oracle port is 1521 and I suspect smartcruddy has made the
assumption that all Oracle DB's will be available over this port.
However - I cannot find the relevant DBI variable to over-ride the Port number
- - has anyone come across this and tried to adjust the port in cruddy itself
I am relatively familiar with DBI and use the following to connect etc
my $oracle_port = "1524";
...
my $dbh =
DBI->connect("dbi:Oracle:host=$oracle_server;port=$oracle_port;sid=$oracle_sid");
But the only place in Cruddy collects these variables is from apache2
httpd.conf file (as follows):
# Smart Cruddy
SetEnv DBI_DSN dbi:Oracle:mydb
SetEnv DBI_USER myuser
SetEnv DBI_PASS mypass
SetEnv DBI_PORT 1524
# DBI Variables
SetEnv DBI_DRIVER Oracle
SetEnv DBI_PORT 1524
SetEnv DBI_USERNAME myuser
SetEnv DBI_PASSWORD mypass
SetEnv DBI_DATABASE mydb
SetEnv CRUDDY_FAST_TEMPLATE_PATH /var/www/tpl
SetEnv SMARTCRUDDY_FAST_TEMPLATE_MAIN smartcruddy.tpl
# Variables definately set in environment - but proving so below
# PassEnv LD_LIBRARY_PATH
# PassEnv ORACLE_HOME
SetEnv LD_LIBRARY_PATH /opt/oracle/product/11.1.0/lib
SetEnv ORACLE_HOME /opt/oracle/product/11.1.0
I have tried the following on httpd DBI_DSN
SetEnv DBI_DSN dbi:Oracle:mydb:1524
(along with all the other required variables I should add)
to no avail
Is there a DBI_PORT switch or some other relevant variable?
Error messages from this product
When I run the smartcruddy.pl script that is shipped from the command the
following message is returned
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 /usr/local/share/perl/5.10.0/CGI/CRUD/CGIOutputFastTemplate.pm
line 38
When I run the script as intended from a browser - I get the appropriate HTTP
500 and the apache2/error.log reads as follows
[Fri Jul 02 19:20:48 2010] [error] [client 10.234.18.189] DBI
connect('mydb','rep_dwh',...) failed: ERROR OCIEnvNlsCreate. Check ORACLE_HOME
(Linux) env var or PATH (Windows) and or NLS settings, permissions, etc. at
/usr/local/share/perl/5.10.0/CGI/CRUD/CGIOutputFastTemplate.pm line 38
[Fri Jul 02 19:20:48 2010] [error] [client 10.234.18.189] [CGI::FastTemplate]
Warning: no value found for variable: HOME_URL
[Fri Jul 02 19:20:48 2010] [error] [client 10.234.18.189] Can't call method
"header" on an undefined value at
/usr/local/share/perl/5.10.0/CGI/CRUD/CGIOutputFastTemplate.pm line 91.
[Fri Jul 02 19:20:48 2010] [error] [client 10.234.18.189] Premature end of
script headers: smartcruddy.pl
Help really appreciated - if this can get working I can advance our BI stack
dramatically
#/usr/local/share/perl/5.10.0/CGI/CRUD/CGIOutputFastTemplate.pm : line 39
89 my $gob = $tpl->fetch('CONTENT');
90
91 print $self->{cgi}->header, $$gob;
#/usr/local/share/perl/5.10.0/CGI/CRUD/CGIOutputFastTemplate.pm : line 38
unless ($self->{dbh} = DBI->connect(undef,undef,undef,{ PrintError => 1,
RaiseError => 0, AutoCommit => 1, }))
# the main smartcruddy.pl script declares the $dbh as follows - which is just
plain confusing
my $r = new CGI::CRUD::CGIOutputFastTemplate($q) or exit 0;
...
if (!length($req_table_name) || $r->param('__SDAT_TAB_ACTION.RESTART'))
{
request_action($r);
}
else
{
my $report = new DBIx::Knowledge::Report($r,$req_table_name) or exit 0;
$report->{action} = $action;
$report->select_list_from_table(uc($req_table_name)) or exit 0;
$report->take_action();
}
sub request_action
{
my ($r) = @_;
my $dbh = $r->dbh();
my $form = $r->form($dbh);
...
}