Loading ...
Sorry, an error occurred while loading the content.

getdata from database with #shell and direct cgi-mode

Expand Messages
  • schatzer.johann
    Why does this shell-construct not work in cgi-mode? It renders the plot, but without data. #proc getdata data: #shell psql -F, -t -ddatabase -Pformat=unaligned
    Message 1 of 4 , Apr 11 6:32 AM
    • 0 Attachment
      Why does this shell-construct not work in cgi-mode? It renders the plot, but without data.

      #proc getdata
      data:
      #shell
      psql -F, -t -ddatabase -Pformat=unaligned -c"select * from table"
      #endshell

      #proc page
      etcetera ...

      -----
      The same script works fine when ploticus is invoked from the command-line.

      -----
      If I use the output of the above database command, the cgi mode works fine.
      #proc getdata
      data:
      23 41 19 17
      etc. ...
    • Platonides
      ... Does psql have permission to run and connect to the db as the user under which the cgi is run as?
      Message 2 of 4 , Apr 25 5:17 PM
      • 0 Attachment
        schatzer.johann wrote:
        > Why does this shell-construct not work in cgi-mode? It renders the plot,
        > but without data.
        >
        > #proc getdata
        > data:
        > #shell
        > psql -F, -t -ddatabase -Pformat=unaligned -c"select * from table"
        > #endshell
        >
        > #proc page
        > etcetera ...
        >
        > -----
        > The same script works fine when ploticus is invoked from the command-line.
        >
        > -----
        > If I use the output of the above database command, the cgi mode works fine.
        > #proc getdata
        > data:
        > 23 41 19 17
        > etc. ...
        >
        >

        Does psql have permission to run and connect to the db as the user under
        which the cgi is run as?
      • Stephen Grubb
        Hello, To supplement what Johann said below..... - you should determine what UID your CGI process is running as (typically nobody ) ... and whether this UID
        Message 3 of 4 , Apr 27 11:18 AM
        • 0 Attachment
          Hello,

          To supplement what Johann said below.....

          - you should determine what UID your CGI process is running as (typically "nobody") ... and whether this UID has necessary psql permissions
          - you should determine the PATH available to your CGI process (typically quite limited) ... perhaps your process isn't able to find the psql command

          Steve

          ________________________________________
          From: ploticus@yahoogroups.com [ploticus@yahoogroups.com] On Behalf Of Platonides [platonides@...]
          Sent: Saturday, April 25, 2009 8:17 PM
          To: ploticus@yahoogroups.com
          Subject: Re: [ploticus] getdata from database with #shell and direct cgi-mode

          schatzer.johann wrote:
          > Why does this shell-construct not work in cgi-mode? It renders the plot,
          > but without data.
          >
          > #proc getdata
          > data:
          > #shell
          > psql -F, -t -ddatabase -Pformat=unaligned -c"select * from table"
          > #endshell
          >
          > #proc page
          > etcetera ...
          >
          > -----
          > The same script works fine when ploticus is invoked from the command-line.
          >
          > -----
          > If I use the output of the above database command, the cgi mode works fine.
          > #proc getdata
          > data:
          > 23 41 19 17
          > etc. ...
          >
          >

          Does psql have permission to run and connect to the db as the user under
          which the cgi is run as?
        • Johann Schatzer
          Stephen Grubb : Thank you, grant select on table to www-data (my CGI process s UID) and it works. Hans ... -- Johann Schatzer
          Message 4 of 4 , Apr 28 11:01 AM
          • 0 Attachment
            Stephen Grubb <Stephen.Grubb@...>:

            Thank you,

            grant select on table to www-data (my CGI process's UID)

            and it works.

            Hans
            >
            >
            > Hello,
            >
            > To supplement what Johann said below.....
            >
            > - you should determine what UID your CGI process is running as (typically
            > "nobody") ... and whether this UID has necessary psql permissions
            > - you should determine the PATH available to your CGI process (typically quite
            > limited) ... perhaps your process isn't able to find the psql command
            >
            > Steve
            >
            > ________________________________________
            > From: ploticus@yahoogroups.com [ploticus@yahoogroups.com] On Behalf Of
            > Platonides [platonides@...]
            > Sent: Saturday, April 25, 2009 8:17 PM
            > To: ploticus@yahoogroups.com
            > Subject: Re: [ploticus] getdata from database with #shell and direct cgi-mode
            >
            > schatzer.johann wrote:
            > > Why does this shell-construct not work in cgi-mode? It renders the plot,
            > > but without data.
            > >
            > > #proc getdata
            > > data:
            > > #shell
            > > psql -F, -t -ddatabase -Pformat=unaligned -c"select * from table"
            > > #endshell
            > >
            > > #proc page
            > > etcetera ...
            > >
            > > -----
            > > The same script works fine when ploticus is invoked from the command-line.
            > >
            > > -----
            > > If I use the output of the above database command, the cgi mode works fine.
            > > #proc getdata
            > > data:
            > > 23 41 19 17
            > > etc. ...
            > >
            > >
            >
            > Does psql have permission to run and connect to the db as the user under
            > which the cgi is run as?
            >
            >
            >

            --
            Johann Schatzer
          Your message has been successfully submitted and would be delivered to recipients shortly.