Help with interactive SQL using PERL 
Author Message
 Help with interactive SQL using PERL

Hi there all you PERL experts in net land...

I have a little problem.

Below, there is a little shell script which will call 'interactive sql', and
send a command to it to tell me the contents of a single table.

Also below, there is a little perl script which calls the shell script, and
captures the output and simply prints it out.

My question....

How do I combine them into a SINGLE perl program?
Do I need to set up a pipe to the ISQL program?
If so, does anyone have any examples?
It would be greately appreciated.... thanks, Howie

******* HERE IS THE PERL SCRIPT (howie.pl) ******

#!/usr/local/bin/perl

#
# handle the SQL CALLS here.
#

$| = 1;         # command buffering on stdout

# call the SHELL to call Interactive SQL and capture/print it's output.
open (INTSQL, "'sh' < howie.sh |");
while (<INTSQL>){
    print;

Quote:
}

print "Back in perl \n";
..

******* HERE IS THE SHELL SCRIPT (howie.sh) ******

#!/bin/sh
#
#
echo "Hello there from howie's shell script"

DBO=testdbo
PASSWD=testdbo
ISQL="/usr/sybase/bin/isql"
TABLE="T_RPRC_ACCT"

# Do a SQL call to print contents of $TABLE.
${ISQL} -U${DBO} -P${PASSWD} <<- EOF
        select * from ${TABLE}
        go
EOF

****************************************

Again, thanks for your help.  Howie.

--

            o   o   o   o
          o  Howie Grapek o
          o  o   o   o   o
         o
        o    ______          ______
        _ *o(_||___)________/___
      O(_)(       o _______/    \
      ^  `/------o-'             \
    *____/

        Email:   ...{boulder,ncar}!stcvax!blackcat!howie

                Storage Technology Corporation
                2270 South 88th Street
                Louisville, CO   80026-4286
                Office: (303) 673-5066,  FAX: (303) 673-6039
-----------------------------------------------------------------------------



Thu, 21 Mar 1996 06:43:59 GMT  
 Help with interactive SQL using PERL

Hi there all you PERL experts in net land...

I have a little problem.

Below, there is a little shell script which will call 'interactive sql', and
send a command to it to tell me the contents of a single table.

Also below, there is a little perl script which calls the shell script, and
captures the output and simply prints it out.

My question....

How do I combine them into a SINGLE perl program?
Do I need to set up a pipe to the ISQL program?
If so, does anyone have any examples?
It would be greately appreciated.... thanks, Howie

******* HERE IS THE PERL SCRIPT (howie.pl) ******

#!/usr/local/bin/perl

#
# handle the SQL CALLS here.
#

$| = 1;         # command buffering on stdout

# call the SHELL to call Interactive SQL and capture/print it's output.
open (INTSQL, "'sh' < howie.sh |");
while (<INTSQL>){
    print;

Quote:
}

print "Back in perl \n";
..

******* HERE IS THE SHELL SCRIPT (howie.sh) ******

#!/bin/sh
#
#
echo "Hello there from howie's shell script"

DBO=testdbo
PASSWD=testdbo
ISQL="/usr/sybase/bin/isql"
TABLE="T_RPRC_ACCT"

# Do a SQL call to print contents of $TABLE.
${ISQL} -U${DBO} -P${PASSWD} <<- EOF
        select * from ${TABLE}
        go
EOF

****************************************

Again, thanks for your help.  Howie.

--

            o   o   o   o
          o  Howie Grapek o
          o  o   o   o   o
         o
        o    ______          ______
        _ *o(_||___)________/___
      O(_)(       o _______/    \
      ^  `/------o-'             \
    *____/

        Email:   ...{boulder,ncar}!stcvax!blackcat!howie

                Storage Technology Corporation
                2270 South 88th Street
                Louisville, CO   80026-4286
                Office: (303) 673-5066,  FAX: (303) 673-6039
-----------------------------------------------------------------------------



Thu, 21 Mar 1996 12:33:36 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Need help on using Perl as an interactive interface

2. Interactive SQL and PERL question.

3. Using perl to control interactive processes?

4. interactive web 3D using Perl?

5. using perl to automate testing of interactive processes

6. LONG: Req: Help in retrieving values from SQL Server stored procedure using Win32::ODBC

7. Help! Problem using Sprite SQL module

8. HELP ODBC sql stmt failing when using WHERE LIKE

9. Need help getting perl compiled on Interactive.

10. PL/SQL to C conversion using Perl anybody?

11. Using DB Perl with SQL server ??

12. Connecting to SQL Server through ODBC using Perl

 

 
Powered by phpBB® Forum Software