How can I use a database server from a Perl CGI script?

My program works already, I have Perl (GUI Window), where I can enter data, data transferred to a web page (using Tomcat server, JSP), and then saved for database oracle. I want to make a search parameter (webapp) that retrieves / retrieves data from an Oracle database using Perl CGI. Is it possible? Or any suggestions for solving my program? Thanks!: -)

0
source share
2 answers

Yes, you can use DBI and DBD :: Oracle Modules .

However, there are some problems with Oracle. I remember some funny games and games with Oracle 8, so they can no longer be applied, but in some cases require the setting of ENV variables, such as ORACLE_HOME, ORACLE_BASE and ORACLE_SID.

In DBD :: Oracle, the doc goes into this, and another ENV TWO_TASK variable is also mentioned. Therefore, getting it to work may depend on ...

  • which version of Oracle do you have
  • do you have a listener (which i think you need for network access like CGI?)
  • which version of SQL * Net is used.

It seems complicated, but all you probably need is to add these ENV variables to the web server (iPlanet is what I used at the time). As an alternative from a DBD :: Oracle document, it gives ...

BEGIN {
  $ENV{ORACLE_HOME} = '/home/oracle/product/10.x.x';
  $ENV{TWO_TASK}    = 'DB';
}
$dbh = DBI->connect('dbi:Oracle:','scott', 'tiger');
#  - or -
$dbh = DBI->connect('dbi:Oracle:','scott/tiger');

PS. , CGI script , Oracle! , ENV , ( script !)...

my $db = DBI->connect("dbi:Oracle:host=$host;sid=$database", $user, $pass, 
  { RaiseError => 0, PrintError => 0 } )
  or croak( "Unable to connect to DB - $DBI::errstr" );

, , - TNLISTENER.CONF Oracle ( , !), , Oracle ( ).

+5

? /JSP?

Perl, , - Perl script.

Apache, mod_perl.

, Perl tomcat, .

perl script, DBI/DBD:: Oracle ?

, ...

+2

All Articles