develooper Front page | perl.dbi.users | Postings from February 2001

Cross platform problems

Thread Next
From:
Stan Brown
Date:
February 12, 2001 11:00
Subject:
Cross platform problems
Message ID:
perl.dbi.users-346@nntp.perl.org
I have a perl script which I have extensivly tested on a HP-UX box
connecting to an Oralce 7.3.4.5 instance that resides on that box. 

Now I am trying to offload the work of this script, and am trying to get it
to work on a Debina Linux systesm. On this machine I have installed Oracle
8i.

I am able to get the script to connect to the remote DB, but it seems that
the first thing it does (check for the existence of a tbale) fails. 

Now I am really fairly new at perl, and espically DBI, so I have probably
done somehtig wrong that just happens to work in the original envrionemtn,
but not in the second one I tried.

Here is a snippet of the code:

#!/opt/local//bin/perl -w

# "@(#)data_fetch.pl	1.4 01/01/12 13:45:30";  /* SCCS what string */ 
#
# data_ftech.pl
#
# 12-13-2000 SDB 
#
# retrieves data from Oracle data base, and prepares
# it for ftp trnasfer to Oil Systems PI

use DBI;
use DBD::Oracle ;
use strict;
use AppConfig::File;
use File::lockf;
use IO::Handle;
use Getopt::Mixed "nextOption";
use Time::HiRes qw( gettimeofday tv_interval);
use Data::Dumper;
use pi_common;


# this is for Oracle
# Connect to the DB
# Since this script will be doing SELECT's only
# we ste autocommit to 0 which should
# give us (lighter weight) read only transaction behavior
$dbh = DBI->connect('dbi:Oracle:pwhse','flink','flink',
			{ RaiseError => 1, AutoCommit => 0 })
		 or die "Unable to connect: $DBI::errstr";

	# cover the case of someone deleting a tag from the tags file
	# while we are runing
	# Might want to move these out to the init() routine
	# now that we dynamicly reload the tags file
	undef %record;
	# Prepare some queries to verify the supplied config data
	$stht = $dbh->prepare("SELECT TABLE_NAME FROM ALL_TABLES where
	TABLE_NAME = ? ") 
		or die $DBI::errstr;

		# Next, verify that the table requested exists on the Oracle
		# DB
		$table_qty = $stht->execute ( $rval[1] );
		if ( $table_qty eq "0E0" )
		{
			# Supplied Table name does not exist
			if($::config{badinit} == 1)
			{
				logit(1,
				$::config{collect_task_log_file},
				"Bad Oracle table name, $rval[1] at line number $line_no in config fle $::config{tags_file}, but overide flag set, so I am continuing");
				if($::Debug >= 1)
				{
					print("Bad Oracle table name, $rval[1] at line number $line_no in config fle $::config{tags_file}, but overide flag set, so I am continuing\n");
				}
			}
			else
			{
				logit(1,
				$::config{collect_task_log_file},
				"Bad Oracle table name, $rval[1] at line number $line_no in config fle $::config{tags_file}, exiting");
				if($::Debug >= 1)
				{
					print("Bad Oracle table name, $rval[1] at line number $line_no in config fle $::config{tags_file}, exiting\n");
				}
				# Failed test, and force mode not on
				# cleanup and exit
				$stht->finish();
				$sthc->finish();
				close FILE;
				clean_house();
				exit;
			}
		}

	Any ideas what I am doing wrong here? 

	If I connect from teh Linux box, and run the statement by had it
	returns one row, as expected.

-- 
Stan Brown     stanb@awod.com                                    843-745-3154
Charleston SC.
-- 
Windows 98: n.
	useless extension to a minor patch release for 32-bit extensions and
	a graphical shell for a 16-bit patch to an 8-bit operating system
	originally coded for a 4-bit microprocessor, written by a 2-bit 
	company that can't stand for 1 bit of competition.
-
(c) 2000 Stan Brown.  Redistribution via the Microsoft Network is prohibited.

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About