Hire A Programmer
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOtherHire A Programmer

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old July 30th, 2004, 11:52 AM
FALCONSEYE FALCONSEYE is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 377 FALCONSEYE Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 16 h 57 m 14 sec
Warnings Level: 15
Number of bans: 1
Reputation Power: 0
Question NEED Pro Help! Will Pay

Hi
the script below generates this error

Cannot open T:\OUT\VERIFS No such file or directory

Code:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
use strict;
use warnings;
use DBI;


my $MyFolder = 'T:\OUT\VERIFS';
opendir(DIR, $MyFolder) or die ("Cannot open $MyFolder $!\n");


my @VerFiles = grep /\.ver/, (readdir DIR);
chomp @VerFiles;

foreach my $item (@VerFiles){
if (substr ($item, 0, 3) eq '716'){
my $MyTarget = "${MyFolder}\\$item";
&insertRec($MyTarget);
}
}


sub insertRec{
my $filename = shift;
my $zone = substr($filename, 19, 3);
my $network = substr($filename, 17, 2);

my $DSN = 'driver={SQL Server};Server=SERVER1;database=VerifDB;uid=sa;pwd=password';
my $dbh = DBI->connect("dbi:ODBC:$DSN",'sa','password') or die "$DBI::errstr\n";

open(FILE, $filename) or die ("Cannot open the file because: $!");

while(<FILE>){
my ($LOI,$DateAired,$ScheduledTime,$blah1,$blah2,$blah3,$blah4,$blah5,$ActualAirTime,$ActualAirLength,$   ActualAirPos,$SpotID,$Status) = split (' ', $_);

if($LOI eq 'LOI'){

my $sql = "INSERT INTO VerificationFiles VALUES ($zone,$network,'$DateAired','$ScheduledTime','$ActualAirTime','$ActualAirLength','$ActualAirPos' ,'$SpotID','$Status')";
my $sth = $dbh->prepare($sql);
$sth->execute();
$sth->finish;
}
}
close(FILE);
$dbh->disconnect;
}
closedir DIR;

print "<html><body>";
print "<h3> New records have been created!</h3>";
print "</body></html>";



i had a problem with reaching the T:\OUT\Verifs folder. However, I have full access to open, read any files in that folder.
the files i am trying to read resides on server2, the perl script will be posted on server1. when someone runs the scipt from user1 machine, it will open up those files on server2, read thru, extract some fields and then insert into a DB on server1.

i think i have a similar problem with the following script.

Code:
use strict;
use warnings;

open (FH,  "T:/OUT/61012049.ver") or die $!;

print while (<FH>);


when i save this on server1 and try to run it from there, it gives
Permission denied at D:\Montana\Fails\test.pl
by the way, d: is server1 and t: is server2. t: is mapped on server1.

i would rather use the full UNC path. something like
"//novardb1/tnb1/out/verifs" for the server2.

Last edited by edwinbrains : July 31st, 2004 at 04:19 AM.

Reply With Quote
  #2  
Old July 30th, 2004, 01:26 PM
bombaywala bombaywala is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Arlington, VA
Posts: 191 bombaywala User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 24 m 37 sec
Reputation Power: 5
Send a message via AIM to bombaywala Send a message via MSN to bombaywala Send a message via Yahoo to bombaywala
Your script looks like Unix related and T: ??? Unix does not have T: style of pointing to folders. It should be instead, /usr/local/....

Reply With Quote
  #3  
Old July 30th, 2004, 01:33 PM
FALCONSEYE FALCONSEYE is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 377 FALCONSEYE Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 16 h 57 m 14 sec
Warnings Level: 15
Number of bans: 1
Reputation Power: 0
Quote:
Originally Posted by bombaywala
Your script looks like Unix related and T: ??? Unix does not have T: style of pointing to folders. It should be instead, /usr/local/....


this is actually a windows 2000 server. i tried almost everything, with full unc paths without them and still couldn't get it to work..

Reply With Quote
  #4  
Old July 30th, 2004, 01:38 PM
bombaywala bombaywala is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Arlington, VA
Posts: 191 bombaywala User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 24 m 37 sec
Reputation Power: 5
Send a message via AIM to bombaywala Send a message via MSN to bombaywala Send a message via Yahoo to bombaywala
Did you try running the script locally? I don't think perl compiler on box a will be able to open file on box b and vice versa.

Reply With Quote
  #5  
Old July 30th, 2004, 01:41 PM
FALCONSEYE FALCONSEYE is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 377 FALCONSEYE Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 16 h 57 m 14 sec
Warnings Level: 15
Number of bans: 1
Reputation Power: 0
Quote:
Originally Posted by bombaywala
Did you try running the script locally? I don't think perl compiler on box a will be able to open file on box b and vice versa.


everything works just fine on my machine. it opens up those files on the server2, reads them, inserts them into the DB. but the problem starts when i move the script on the server1 and try to run it from there. i will award you if you help me solve this problem...
thanks

Reply With Quote
  #6  
Old July 30th, 2004, 02:17 PM
bombaywala bombaywala is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Arlington, VA
Posts: 191 bombaywala User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 24 m 37 sec
Reputation Power: 5
Send a message via AIM to bombaywala Send a message via MSN to bombaywala Send a message via Yahoo to bombaywala
Does Server 1 have permissions to access files on Server 2? Also, when you copy the file on Server1 from your local - are you ftp'ing? Or just copy paste, sometimes if you copy Perl scripts in binary mode then they start acting up. It is really hard for me to help since I cannot see your environment - I don't think there is anything wrong with your script, it seems like some networking, file permissions issue.

Reply With Quote
  #7  
Old July 30th, 2004, 02:19 PM
FALCONSEYE FALCONSEYE is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 377 FALCONSEYE Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 16 h 57 m 14 sec
Warnings Level: 15
Number of bans: 1
Reputation Power: 0
Quote:
Originally Posted by bombaywala
Does Server 1 have permissions to access files on Server 2? Also, when you copy the file on Server1 from your local - are you ftp'ing? Or just copy paste, sometimes if you copy Perl scripts in binary mode then they start acting up. It is really hard for me to help since I cannot see your environment - I don't think there is anything wrong with your script, it seems like some networking, file permissions issue.



i aggree. i save the script on server1. and server1 has permissions to access files on server2. my files are saved under
\\server1\montana\fails and from there i try to reach \\server2\tnb1\out. will that be the problem?

Reply With Quote
  #8  
Old July 30th, 2004, 02:35 PM
bombaywala bombaywala is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Arlington, VA
Posts: 191 bombaywala User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 24 m 37 sec
Reputation Power: 5
Send a message via AIM to bombaywala Send a message via MSN to bombaywala Send a message via Yahoo to bombaywala
The path you mentioned here is different then the one in the script! Are they pointing to the right place? Does the file already exist on the Server? If not then try creating one and then running the script. Other then that I really can't think of anything else...

Reply With Quote
Reply

Viewing: Dev Shed ForumsOtherHire A Programmer > NEED Pro Help! Will Pay


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway