On Tue, 9 Jul 2002 09:03:42 -0400 "Kakli, Samir (S.A.)" <[EMAIL PROTECTED]> wrote:
> I'm having the following problem using DBI. My perl version is 5.005,
> and Oracle.pm version is 1.47. Can you help?
That internal version number doesn't necessarily change with DBD::Oracle
versions. The DBD::Oracle version is more useful to most of us.
You can see the DBD::Oracle version by executing this one-liner:
perl -MDBD::Oracle -e 'print $DBI::Oracle::VERSION'
> -----------------CGI script------------------------
#!/usr/bin/perl -w
## Replace /usr/bin/perl with the correct directory unless you are
## suffering under MS Windows. Under MSW, the correct directory isn't
## necessary since MS doesn't use #! lines.
## I don't see a #! or use strict in your script. Some prefer to
## remove the -w when CGI goes into production, but for testing, both
## should be present.
use strict;
> use DBI;
> use CGI;
## I don't use CGI myself, but there is an option ':fatalsToBrowser'
## which will allow you to see what error occured.
## Some HTTP/HTML initialization may be necessary as well.
> $ENV{ORACLE_HOME}='/ford/thishost/unix/cen/oracle/v7/7.3.2';
## It would be far better if this could be set in the webserver's
## environment. That way when you upgrade Oracle (and DBD::Oracle),
## you won't have to change all your DBI scripts.
## Likewise it would be a good idea to store the userid, password,
## and instance outside the script as well.
> $OracleUser = 'e01';
> $OraclePassword = 'user01';
> $Database = 'pt5100_pfsdb01';
> $dbHandle = DBI->connect($Database,$oracleUser,$oraclePassword,'Oracle')
> or die "Could not login";
####
## Note that -w and use strict would have told you that the variables
## you set ($OracleUser and $OraclePassword) aren't the same ones you
## used in the connect() call ($oracleUser and $oraclePassword).
## Hint: Letter case is signficant in Perl ($oracleUser != $OracleUser).
####
## It would be better to use the 'new' (5 years now?) form of connect().
## That frees up the last argument for options:
my $dbHandle = DBI -> connect( "dbi:Oracle:$Database",
$OracleUser, $OraclePassword, { AutoCommit => 0, PrintErrors => 0 } )
or die "Connect to $Database as $OracleUser failed, $DBI::errstr\n";
## Note the more detailed die() message.
# Unless you want to specifically check every statement
$dbHandle -> {RaiseErrors} = 1;
> ------------------Server error log------------------------
> [08/Jul/2002:15:25:47] failure: for host 19.49.166.225 trying to GET
> /data_mgt/cgi-bin/mnfg_tac3.cgi, cgi-parse-output reports: the
> CGI program /ford/thishost/proj/web/data_mgt/cgi-bin/mnfg_tac3.cgi did
> not produce a valid header (name without value: got line "use
> of uninitialized value at /opt/perl5/lib/site_perl/dbd/oracle.pm line
> 141.")
--
Mac :})
** I normally forward private questions to the appropriate mail list. **
Ask Smarter: http://www.tuxedo.org/~esr/faqs/smart-questions.html
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.