CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: General Discussions: General Questions:
Perl web application can not connect new oracle database

 



newtonbd
New User

Jun 28, 2016, 9:14 PM

Post #1 of 3 (5083 views)
Perl web application can not connect new oracle database Can't Post

Hi,
We have a Perl based internal web application. We have 2 servers, one for production and another for test. Both were pointing same database server which is declared in the common.pm files.
I have been assigned this project to use different database for test server. I am learning pearl from online and using text book.
I have made ready oracle based test database which is replicated the production one. I can connect database using SQL developer application.
I have edited to change the database name in the common.pm file where the database name was the production one. But it is not connecting to the database.
Could anyone please help me to resolve this issue? Thanks in advance.

Is there any information where I can check for oracle ODBC connection driver installed in the server?
Regards
Newton


(This post was edited by newtonbd on Jun 30, 2016, 8:08 PM)


FishMonger
Veteran / Moderator

Jul 1, 2016, 6:57 AM

Post #2 of 3 (5046 views)
Re: [newtonbd] Perl web application can not connect new oracle database [In reply to] Can't Post

Since you haven't shown any code or error messages, it's hard to say what's wrong.

Is your script using the DBI module, like it should be doing, to connect to the database? If you're using DBI, then the driver module is DBD::Oracle. http://search.cpan.org/~pythian/DBD-Oracle-1.74/lib/DBD/Oracle.pm

You can check if it's installed by executing this from the command line.

Code
perl -MDBD::Oracle -e 1

If it's installed, you won't get any output, but if it's not installed, it will output an error message.


newtonbd
New User

Jul 3, 2016, 8:09 PM

Post #3 of 3 (5019 views)
Re: [FishMonger] Perl web application can not connect new oracle database [In reply to] Can't Post

Thank you for your reply. Could you please let me know where do I need to execute the command line? using cmd in the server?

Please see the code below in the common.pm file.

sub sql_do {
# run an SQL command or commands (no output is returned)
my ($sql, $plog, $tlog) = @_;
#print $plog "sql_do:\n$sql\n" if $plog;
my $sqlprint = substr($sql,0,500);
logtime($sqlprint, $plog) if $plog; # length($sql)<100;

# connect to DB
my $retry = 0;
my $dbh;
until ( $dbh = DBI->connect($pg3db, $manacc, $manword,{PrintError => 0, RaiseError =>0}) ) {
print $plog "Can't connect: $DBI::errstr. Pausing before retrying.\n";
$retry++;
sleep(5);
#sleep(4) if $retry > 5;
die("Can't connect: $DBI::errstr.\n") if $retry > 5;
}

$dbh->do("Alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss'");
$dbh->do("Alter session set current_schema=$schema");

Thanks

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives