trouble connecting to Oracle

2007-07-27 Thread Dan Jablonsky
hi all, 
i tried to send this to perl-DBI but it did not get
through, nevertheless, maybe someone has any ideea,
please.
I am executing the following code:

use CGI;
use DBI;
use strict;

my $query = new CGI;

print $query-header;
print $query-start_html(My Page);

print BODY BGCOLOR=#FF\n;
print LEFT\n;

print My List hereBR\n;


print_prompt($query);
print I GOT HERE!  -- form printed;
do_work($query);
print I GOT HERE!  -- values processed;

#connect to ORACLE
print \BR;
print I GOT HERE!  -- before db connection;
print \BR;

my $usr = testusr;
my $pwd = testpwd;
my $dbh =
DBI-connect('dbi:Oracle:ORCL_192.168.55.116', $usr,
$pwd) || die Database connection not made:
$DBI::errstr;

print I GOT HERE!  -- db connected;
$dbh-disconnect;
print \BR;
print I GOT HERE!  -- db disconnected;
#
print $query-end_html;

# SUBROUTINES ###
sub print_prompt {
#put some check boxes on the page, submit button, etc.
}

sub do_work {
unless ($query-param) {
print bNo query submitted yet./b;
return;
#get some values, etc.
}

it never gets after the connection line (it prints
only:
I GOT HERE! -- form printed
I GOT HERE! -- values processed
I GOT HERE! -- before db connection)
, HOWEVER I never get any error; I am definitely not
connecting but I can't see anything wrong here!

WinXP, Oracle 10.2.0.0 server, Oracle 10.2.0 client,
Perl
5.8.6.811,
any idea what's happening?

Thanks,
jablonsky



   

Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for 
today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow  
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


perl 5.8.6 811 and oracle 10g installing 5.8.3

2007-06-26 Thread Dan Jablonsky
hi all,
i have had Perl 5.8.6.811 running for quite some time
on my machine. Everything was fine until I had to
install Oracle 10g.
Now, whenever I try to execute one of my old perl
scripts I get the following error:
Perl lib version (v5.8.3) doesn't match executable
version (v5.8.6) at
C:\oracle\product\10.2.0\db_1\perl\5.8.3\lib/MSWin32-x86-multi-thread/Config.pl
line 32
BEGIN failed--compilation aborted at
C:\oracle\product\10.2.0\db_1\perl\5.8.3\lib/MSWin32-x86-multi-thread/DynaLoader.pm
line 25
and then I have a few more lines ...
I guess the problem is with Oracle that re-wrote the
environment variables in System Properties:

for PERL5LIB what I have now is:
C:\oracle\product\10.2.0\db_1\perl\5.8.3\lib\MSWin32-x86;C:\oracle\product\10.2.0\db_1\perl\5.8.3\lib;C:\oracle\product\10.2.0\db_1\perl\5.8.3\lib\MSWin32-x86;C:\oracle\product\10.2.0\db_1\perl\site\5.8.3;C:\oracle\product\10.2.0\db_1\perl\site\5.8.3\lib;C:\oracle\product\10.2.0\db_1\sysman\admin\scripts;

I do not know what I should change this to in order to
make it work with the 5.8.6 version.

I re-installed 5.8.6.811, I was under the impression
that the environment variables should have been
re-written again, however, nothing changed.

So, anybody could tell me what do I need to change to
revert to 5.8.6.811? I guess I will blow the Oracle
setting, nevertheless I do not care too much about
this now - all I want is to be able to execute my
scripts with 5.8.6.811

thanks,
kowalsky


   
Ready
 for the edge of your seat? 
Check out tonight's top picks on Yahoo! TV. 
http://tv.yahoo.com/
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


download window instead of executing

2007-06-25 Thread Dan Jablonsky
hi all,
just a quick questions: why do I get a download window
when I'm trying to execute a .pl file in the browser?
It's something very simple but I forgot how one fixes
this.

I'll get back with details if necessary,
kowalsky


  

Luggage? GPS? Comic books? 
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=oni_on_mailp=graduation+giftscs=bz
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


lazy, lazy, lazy

2006-12-11 Thread Dan Jablonsky
Hi all,
I have a few admin chores I hate and I'm done with a
couple of them in that I found a way to automate
everything from one end to the other using the
WWW::Mechanize module since the data sources have web
interfaces.
Now I'm left with a few maneuvers that use a
client-server app, it is possible to automate those in
any way. Unfortunatelly I don't have any access to any
internals of those applications, only permissions on
the file system, network and all ... 
I would like to try only for the fun of it, if anybody
has any ideas, please let me know,
Thanks,
Dan


 

Any questions? Get answers on any topic at www.Answers.yahoo.com.  Try it now.
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


trouble with insert in MS SQL

2006-12-05 Thread Dan Jablonsky
hi all,
haven't worked with this for a while - still, don't
remember getting this error message ever ...
The code I'm running is below:

use Win32::OLE; 
use Win32::OLE::Const;

$db  = db1;
$srv = mySrv;
$uid = usr1;
$pwd = usr1pwd;

#this is an OLEDB connection to a MS-SQL Database
$connStr =
PROVIDER=SQLOLEDB;SERVER=$srv;DATABASE=$db;UID=$uid;PWD=$pwd;

$conn = Win32::OLE- new(ADODB.Connection) or die
Error creating Connection Object\n;
$rs = Win32::OLE-new('ADODB.Recordset') or die Error
creating Record Set Object\n;;
$conn- Open($connStr);
$rs-Open('Balance', $connStr,
$ado_consts-{adLockOptimistic});

my $Fields = ['ItemId', 'ItemDate', 'ItemAmount',
'ItemComments'];
my $Values = [1, '2006-11-29 2:50:01', '12.34',
'insert try 1'];
$rs-AddNew($Fields, $Values);  # adds
a record

print \nThis didn't go thru: ,
Win32::OLE-LastError(), \n if
(Win32::OLE-LastError());

$rs-Close();
$conn- Close();

When executing the above I get:
This didn't go thru: OLE Exception from
ADODB.Recordset:
Current Recordset does not support updating. This is a
limitation of the provider, or of the selected
locktype.

When using the code without the $rs-Open( ... line it
will complain about executing the AddNew method on a
closed object; when adding $rs-Open() with the params
above it will issue the error.

Any ideas?
Thanks,
Dan



 

Want to start your own business?
Learn how on Yahoo! Small Business.
http://smallbusiness.yahoo.com/r-index
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


readdir problem

2006-11-29 Thread Dan Jablonsky
Hi all,
I am trying to read only files in a directory; I need
to jump over the dot files and any subdirectories.
Seems like a simple thing, however with

opendir(DIR, $dir) || die can't opendir $dir: $!;
foreach my $file (readdir DIR) 
{
next if (/^\./); # skip over dot files
print file name is: $file\n;
}

I get . and .. and all subdirectories.

with

opendir(DIR, $dir) || die can't opendir $dir: $!;
foreach my $file (readdir DIR) 
{
next if -d $file); # skip over directories
print file name is: $file\n;
}

I skip the dot files but I still get the
subdirectories. Any idea how do I get only the plain
files?

Thanks,
Dan


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


problem with tar.gz read

2006-11-16 Thread Dan Jablonsky
Hi everybody,
I guess I still have a problem with my reading of
tar.gz files. Everything work jst great with the
code below until I happened to hit a corrupted file
and I can't see a way to jump over it. My point is
that in a list with hundreds of tar.gz files all of
them are valid, less one (of small size which also
happens to be quite at the top of the list) which
makes the script to go kaboom.

File::Find::find( sub {
 #traversing a file structure
 if($_ =~/\.tar\.gz/)
  {
   #if you found a tar.gz file - open and read
   #build an Archive::Tar object 
   my $tar = Archive::Tar-new($_);
   my @files = $tar-list_files() or die Can't read
TAR.GZ file!\n;
   #go thru the array and look for the pattern
   foreach my $tar_member (@files)
{
 if($tar_member =~/$search_pattern/)
  {
print \nI FOUND 1 file!\n;
#must extract the found file from the archive
$tar-extract_file($tar_member, $some_path);
  }
} 
  }
}, $search_directory);

So, the problem is that my script gets to the line
with my $tar = Archive::Tar-new($_); but starts to
print error messages like:
Couldn't read chunk at offset unknown at C:\path\to
my\script.pl
...
Illegal octal digit '9' ignored at
C:/Perl/site/lib/Archive/Tar/File.pm line 206 and so
on ...

Is there a way to verify the validity of the Tar (or
the file) BEFORE I call the new for the Archive::Tar
object and in case the file is not valid allow to skip
it? By the way, when I try to open the said tar.gz,
WinZip reports :Invalid Archive Directory!

Thanks a bunch,
Dan



 

Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


extract memeber of zip archive to directory

2006-11-14 Thread Dan Jablonsky
Hi all,
would anybody tell me how to extract a zip archive
member to a certain directory?

I used the code below; however I can't extract the
member in other place than the present working
directory (namely, I am checking if the member has a
certain name and if true I extract it - this always
happens in the same directory where the archive
resides):

my $zip = Archive::Zip-new(); 
$zip-read($_) == 0 or die Can't read ZIP file; 
foreach my $member ($zip-members)
{   
  my $zip_member = $member-fileName;
  if($zip_member =~/$search_pattern/)
{
#print \nI FOUND 1 file!\n;
#must extract the found file from the archive
$zip-extractMemberWithoutPaths($member);
}
}

I tried $zip-extractMemberWithoutPaths($member,
$mydir); but it did not work; somehow I'm not able to
find what's missing here ...
Thanks a bunch,
Dan


 

Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


extract members from tar.gz files in Windows

2006-11-14 Thread Dan Jablonsky
Hi all,
new problem encountered - I am trying to write a short
script that will search a pattern in file names that
are either within a directory or inside a zip archive
in some directory. I managed to get the results I
needed while the files were within zip archives (or
unarchived) however now I see some of the archives are
tar.gz and the code doing the trick with the zip
archives obviously are not working when applied to a
tar.gz file.

so the code below i swhat I use for zip archives:

use Archive::Zip;
use Archive::Extract;
use File::Find;

#start searching
File::Find::find(sub{
 if($_ =~/\.zip/)
  {#if you find a zip file - open and read
   my $zip = Archive::Zip-new(); 
   $zip-read($_) == 0 or die Can't read ZIP file; 
   foreach my $member ($zip-members)
{ 
my $zip_member = $member-fileName;
if($zip_member =~/$search_pattern/)
 {
   print \nI FOUND 1 file!\n;
   #must extract this file from the archive
   $zip-extractMember($member, C:/somepath);  }
} 
  }
  elsif($_ =~/\.tar\.gz/)
  {#if you find a tar.gz file - open and read ???
   #build an Archive::Extract object 
my $ae = Archive::Extract-new(archive = $_);
my @files = $ae-files;
? i don't know if I can go on here ...
  else
  {
   if($_ =~m/$search_pattern/)
{
print \nI FOUND 1 file!\n;
#move this file to some directory
}
  }
}, $search_directory);

So, I guess I don't know what is the equivalent module
for tar.gz that would do the same thing as
Archive::Zip for zip ... (I tried Archive::Extract but
I got nowhere).

Any help would be appreciated,
Thanks,
Dan


 

Yahoo! Music Unlimited
Access over 1 million songs.
http://music.yahoo.com/unlimited
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


stop a Windows application from within a Perl script

2006-04-17 Thread Dan Jablonsky
Hi all,
I have a very simple script that pings the outside
world and reboots a router when it gets no answer to
the ping anymore; on top of that I need to stop and
start again a windows application.
I know how to start the app and I know how to stop it
if it were unix - to stop the app, just kill the
associated process ...
How does one do this in Windows?

Thanks a bunch,
Dan

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


parsing event logs in win2000

2005-06-01 Thread Dan Jablonsky
hi all,
i need to parse system event logs for win2000
Professional and i can see what i'm looking for when i
use the viewer; i can also save the log in text format
from the viewer.

Is there any way i could programmatically get an *.evt
file in a given path AND SAVE IT IN TEXT FORMAT, and
then open and parse?

Thanks,
David



__ 
Discover Yahoo! 
Stay in touch with email, IM, photo sharing and more. Check it out! 
http://discover.yahoo.com/stayintouch.html
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


auditing shutdowns for win2000

2005-05-31 Thread Dan Jablonsky
hi all,
i'm trying to write the simplest program to log
win2000 activity - first step is distinguish between
graceful vs. non graceful shutdowns. is there a way to
write something in a file during the event of a
shutdown? Or rather can i write something in a file
that is guaranteed to be there as long as there's no
ungraceful shutdown and definetely NOT there is an
ungraceful shutdown happens?

Thanks a lot,
Dan 



__ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new Resources site
http://smallbusiness.yahoo.com/resources/
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


perl executed out of c#

2005-02-17 Thread Dan Jablonsky
Hi all,
i have the following code in a c# application:

public void execscript()
{
  Process myprocess = new Process();
  try
 {
string perl_script = err0.pl;
myprocess.StartInfo.FileName c:\\perl_dev\\ +
perl_script;
myprocess.StartInfo.CreateNoWindow = false;
myprocess.StartInfo.WindowStyle =
ProcessWindowStyle.Maximized;
myprocess.StartInfo.UseShellExecute = true;
myprocess.Start();
myprocess.WaitForExit(1);
EventLog.WriteEntry(exterr, test mesg);
myprocess.Close();
 }
catch (Exception e)
 {
throw new System.Exception();
 }
}

I need to catch an error raised in the script.
Right now the script contains only one line:
#!perl
die(died here);
Unfortunatelly, I can catch an error like file not
found, no permission BUT I CANNOT CATCH THE die().
Any idea how to do it?

Thanks,
Dan



__ 
Do you Yahoo!? 
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


perl, c# and errors

2005-02-15 Thread Dan Jablonsky
Hi all,
I am running a perl script from within a c#
application.
I use a System.Diagnostics.Process object that takes
care of that. My question is: if I need to trap a perl
error (supposedly using a Win32Exception object) is
there a special way to raise that error in the perl
script? And if so, how exactly do I raise that error?

If you need details I will provide them,
Thanks,
David



__ 
Do you Yahoo!? 
The all-new My Yahoo! - What will yours do?
http://my.yahoo.com 
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


trying to understand how regex works

2002-08-12 Thread Dan Jablonsky

Hi all,
I guess it must be a simple problem, but it's a
mystery to me.
I got 30 fields all separated by pipes in some files
with many many lines. Some of the fields need to be
changed, but mostly I have to drop any line that has
certain values in certain fields.
So I start by skipping any field that has garbage in
it:
open FOUT, /some/path/outputfile.txt;
open FILE /some/path/inputfile.txt;
whileFILE{
p=N;
next if (/.*?\|value_garbage1\|.*?/ ||
/.*?\|value_garbage2\|.*?/ ||
/.*?\|value_garbage3\|.*?/);
#and then I continue with an if
if(/(.*?)\|(.*?)\|30 times/){
$p=Y;
do something to $1; #change field 1
do something to $3; #change filed 3
$fld1=$newfld1;
$fld2=$2;
$fld3=$newfld3;
$fld4=$4;and so on
}
print FOUT $fld1|$fld2|...|$fld30|\n if ($p=Y);
#print the whole thing to the new output 
}

Well, it happens that some of the lines are completely
out of whack and the regex simply stops there - it
doesn't exit, no errors but goes into an infinite loop
even though I don't know how exactly is this possible.
My second if states clearly (or not so clearly) that
if the line does not have 30 fields it should skip the
block, it should NOT print anything at the handle and
should get the next line.
For whatever reason, the first time it encounters a
line with less that 30 fields, it just loops without
end.
I tried to solve this by replacing the .*? in the
references by the actual format of each field and
suddenly it started working but now the regex is a
hundred times slower and the only thing that speeds it
up is to go back to the .*? that really goes fast as
long as the regex is true. I mean if I have 30
fields all the time, the regex works OK and it goes
very fast.

Anybody cares to explain this to me?
Thanks,
Dan 


__
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



computations with backreferences

2001-06-18 Thread Dan Jablonsky

Hi all,
I have a regex, it's isolating some numbers in each
line of a text file and I want to add some computation
with those numbers on the same line. I know you can
basically stick any function in a regex but I don't
know how. Hence, the code below won't work:

$_=~s/^[A-Z]\t(\d{1,2})\t.*\t(\d{2})\t.*/$1\t$2\t($1+$2)/2/;

The forward slash that would terminate wrongly the
regex is actually a divide by.
What is the correct way to do it?
Thanks,
Dan

__
Do You Yahoo!?
Spot the hottest trends in music, movies, and more.
http://buzz.yahoo.com/
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



pkzip in win and unzip in lin

2001-06-13 Thread Dan Jablonsky

Hi all,
I got into some trouble trying to unzip using the
unzip command in Linux (RH 6.2) a number of files that
were zipped in Windows uzing pKzip.
What happens is that I always get an error message
saying my path isn't recognized (probably because all
slashes are backslashes instead of forward). I used
archiving before but this is the first time I need to
pack and un pack under the 2 OSes directory structures
as well as the files under them.

If I managed to confuse you all, that's what I need:
some files are archived with pKzip under Windows, they
are sent to a Linux box and they have to be unzipped
recursively (I believe the C: will become C_ and make
for one folder down from the directory where I execute
the unzipping). What's the best way to do it?
Thanks,
Dan

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



remove duplicate lines

2001-05-29 Thread Dan Jablonsky

Hi all,
I need to remove duplicate lines from a whole bunch of
files, I already have a script that does this but it's
brute force (compare first line with the others one by
one; if no match write it to another file), hence very
inefficient. Somehow I believe there must be a nicer
approach. Does anybody have a script that does that in
an elegant/efficient manner?
Thanks a lot,
Dan

__
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users



symbolic link question

2000-11-22 Thread Dan Jablonsky

Hi everybody,
I was offered an elegant solution to manipulate files
in a directory:


open(OUT,"output_file") || die;
foreach $file (*daily*) { #match files with 'daily'
open(FILE,$file) || die;
while(FILE) {
#do something to that file;
print OUT;
}
close FILE;
}
close OUT;
--

What if I have symbolic links among my filenames? I
would like to get to the name of the file to which the
symlink is pointing and test for the same *daily*
pattern.
And a more basic question: how do I read the name of a
file "behind" a symbolic link and store it in some
variable?

Thanks a lot,
Dan

__
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users