Error while using BCP in from within a Perl Script

Discussion in 'Perl Misc' started by rajpreetsidhu@gmail.com, Jan 10, 2008.

  1. Guest

    Greetings,

    I am trying to bcp in data into a table from inside a perl script.
    Though the data gets inserted into the table but still I am getting
    following error :

    sh: Starting: execute permission denied
    sh: 8: execute permission denied
    sh: syntax error at line 4: `(' unexpected
    sh: Starting: execute permission denied
    sh: 8: execute permission denied
    sh: syntax error at line 4: `(' unexpected

    Code looks like :

    sub bcp_data{

    print "bcp $dest_table in $file_out -c -t '|' -U $source_username -P
    $source_passwd -S $source_server -e $log \n";
    my $returncode = `bcp $dest_table in $file_out -c -t "|" -U
    $source_username -P $source_passwd -S $source_server -e $log`; #
    backticks
    system "$returncode";
    exec "$returncode";
    }


    TIA.

    Regards,
    Rajpreet
    , Jan 10, 2008
    #1
    1. Advertising

  2. writes:

    > sh: Starting: execute permission denied
    > sh: 8: execute permission denied
    > sh: syntax error at line 4: `(' unexpected
    > sh: Starting: execute permission denied
    > sh: 8: execute permission denied
    > sh: syntax error at line 4: `(' unexpected


    These errors come form you shell (hint: it starts with 'sh:'). Are you
    trying to run you perl script with /bin/sh?

    Did you start you script with '#! /usr/bin/perl'?

    //Makholm
    Peter Makholm, Jan 10, 2008
    #2
    1. Advertising

  3. Rajpreet Guest

    My script starts like #!/opt/local/perl/bin/perl .

    Regards,
    Rajpreet
    Rajpreet, Jan 10, 2008
    #3
  4. Peter Makholm <> writes:

    > writes:
    >
    >> sh: Starting: execute permission denied
    >> sh: 8: execute permission denied
    >> sh: syntax error at line 4: `(' unexpected
    >> sh: Starting: execute permission denied
    >> sh: 8: execute permission denied
    >> sh: syntax error at line 4: `(' unexpected

    >
    > These errors come form you shell (hint: it starts with 'sh:'). Are you
    > trying to run you perl script with /bin/sh?
    >
    > Did you start you script with '#! /usr/bin/perl'?


    Sorry, wrong answers.

    You're trying to execute the content of $returncode as a
    shellscript. To debug problems with doing this you might want to print
    the content of $returncode.

    //Makholm
    Peter Makholm, Jan 10, 2008
    #4
  5. Rajpreet Guest

    On Jan 10, 3:22 pm, Peter Makholm <> wrote:
    > Peter Makholm <> writes:
    > > writes:

    >
    > >> sh: Starting: execute permission denied
    > >> sh: 8: execute permission denied
    > >> sh: syntax error at line 4: `(' unexpected
    > >> sh: Starting: execute permission denied
    > >> sh: 8: execute permission denied
    > >> sh: syntax error at line 4: `(' unexpected

    >
    > > These errors come form you shell (hint: it starts with 'sh:'). Are you
    > > trying to run you perl script with /bin/sh?

    >
    > > Did you start you script with '#! /usr/bin/perl'?

    >
    > Sorry, wrong answers.
    >
    > You're trying to execute the content of $returncode as a
    > shellscript. To debug problems with doing this you might want to print
    > the content of $returncode.
    >
    > //Makholm


    I tried printing the contents and everything works fine. Even if I try
    doing BCP in from comand prompt with the printed value, it works fine
    without any error. Problem comes only while running from within the
    perl script.
    Pl suggest.

    Regards,
    Rajpreet
    Rajpreet, Jan 10, 2008
    #5
  6. Rajpreet Guest

    On Jan 10, 3:30 pm, Rajpreet <> wrote:
    > On Jan 10, 3:22 pm, Peter Makholm <> wrote:
    >
    >
    >
    >
    >
    > > Peter Makholm <> writes:
    > > > writes:

    >
    > > >> sh: Starting: execute permission denied
    > > >> sh: 8: execute permission denied
    > > >> sh: syntax error at line 4: `(' unexpected
    > > >> sh: Starting: execute permission denied
    > > >> sh: 8: execute permission denied
    > > >> sh: syntax error at line 4: `(' unexpected

    >
    > > > These errors come form you shell (hint: it starts with 'sh:'). Are you
    > > > trying to run you perl script with /bin/sh?

    >
    > > > Did you start you script with '#! /usr/bin/perl'?

    >
    > > Sorry, wrong answers.

    >
    > > You're trying to execute the content of $returncode as a
    > > shellscript. To debug problems with doing this you might want to print
    > > the content of $returncode.

    >
    > > //Makholm

    >
    > I tried printing the contents and everything works fine. Even if I try
    > doing BCP in from comand prompt with the printed value, it works fine
    > without any error. Problem comes only while running from within the
    > perl script.
    > Pl suggest.
    >
    > Regards,
    > Rajpreet- Hide quoted text -
    >
    > - Show quoted text -


    Yes, I got your point Makholm.

    Thanks a lot! It works now.
    Rajpreet, Jan 10, 2008
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dpackwood
    Replies:
    3
    Views:
    1,767
  2. Raghavendra

    Access Denied for BCP from ASP.NET

    Raghavendra, Oct 3, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    541
    Raghavendra
    Oct 3, 2004
  3. vikrant
    Replies:
    4
    Views:
    265
  4. Rajpreet
    Replies:
    1
    Views:
    425
    Rajpreet
    Jan 18, 2008
  5. Replies:
    4
    Views:
    287
    ccc31807
    Jul 29, 2011
Loading...

Share This Page