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

DBI and SOAP::LITE

Expand Messages
  • caboose@c-lab.de
    Hi, I m using DBI in a SOAP::LITE script, but whenever I try to connect to the database server, nothing happens, not even an error message. I tried the same
    Message 1 of 10 , Jul 3, 2001
    • 0 Attachment
      Hi, I'm using DBI in a SOAP::LITE script, but whenever I try to
      connect to the database server, nothing happens, not even an error
      message.

      I tried the same connect in a normal skript and it worked fine.

      I have tried entering nonsense for the driver or host values and it
      does not give me an error message either.

      I'm fairly sure it's not a a CGI problem. It seems like the script
      continues without waiting for the connect to complete.

      I know DBI has trouble with multi-threading, so I wondered if
      SOAP::LITE puts the subs into a new thread.

      Anyone had this kind of problem before? Might be just some ENVvar
      problem but the DBI manual lists nonsuch.

      Thanks,
      Sabine
    • Chris Davies
      Can you post a *small* example script that fails in the manner you describe? I m using DBI with SOAP::Lite (0.50) both as client and as server and it works
      Message 2 of 10 , Jul 3, 2001
      • 0 Attachment
        Can you post a *small* example script that fails in the manner you describe?

        I'm using DBI with SOAP::Lite (0.50) both as client and as server and it
        works just fine for me.
        Chris


        -----Original Message-----
        From: caboose@... [mailto:caboose@...]
        Sent: Tuesday, July 03, 2001 4:19 PM
        To: soaplite@yahoogroups.com
        Subject: [soaplite] DBI and SOAP::LITE



        Hi, I'm using DBI in a SOAP::LITE script, but whenever I try to
        connect to the database server, nothing happens, not even an error
        message.

        I tried the same connect in a normal skript and it worked fine.

        I have tried entering nonsense for the driver or host values and it
        does not give me an error message either.

        I'm fairly sure it's not a a CGI problem. It seems like the script
        continues without waiting for the connect to complete.

        I know DBI has trouble with multi-threading, so I wondered if
        SOAP::LITE puts the subs into a new thread.

        Anyone had this kind of problem before? Might be just some ENVvar
        problem but the DBI manual lists nonsuch.

        Thanks,
        Sabine


        To unsubscribe from this group, send an email to:
        soaplite-unsubscribe@yahoogroups.com



        Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
      • caboose@c-lab.de
        Here s the script and the offending subroutine. #! /usr/local/perl-5.6.1/bin/perl -w use SOAP::Transport::HTTP; use DBI(); SOAP::Transport::HTTP::CGI
        Message 3 of 10 , Jul 4, 2001
        • 0 Attachment
          Here's the script and the offending subroutine.


          #! /usr/local/perl-5.6.1/bin/perl -w
          use SOAP::Transport::HTTP;
          use DBI();

          SOAP::Transport::HTTP::CGI
          ->dispatch_to('Delivery')
          ->handle;

          package Delivery;
          sub retrieveDocument {
          my ($class, $doc, $name, $passwd) =@_;
          my $returnString="result: ";
          my $dbh = DBI->connect("DBI:mysql:database=delivery;host=brest.c-
          lab.de","root","");
          $returnString="Kein connect: $DBI::errstr";
          #my $sth = $dbh->prepare("SELECT * from documents WHERE
          name='$doc'");
          #$sth->execute();
          #while (my $ref= $sth->fetchrow_hashref()) {
          #$returnString.= "$ref->{'name'} - $ref->{'place'} - $ref->
          {'start'} - $ref->{'owner'} - $ref->{'date'} - $ref->{'status'}";


          #}
          #$sth->finish();
          $dbh->disconnect();
          return $returnString;
          }
        • caboose@c-lab.de
          Hmm, I just found something. DBI needs a modified LD_LIBRARY_PATH to run. I added this to the skript, but it still won t work. Are there any other ENV
          Message 4 of 10 , Jul 4, 2001
          • 0 Attachment
            Hmm, I just found something. DBI needs a modified LD_LIBRARY_PATH to
            run. I added this to the skript, but it still won't work.

            Are there any other ENV Variables needed? I'm stumbling in the dark.
            because there are no errors visible in the server log file.

            All other CGI / SOAP::LITE scripts work fine, so it has to be
            something DBI specific here.

            Any help?
            Sabine
          • Chris Davies
            Can you use DBI in a similar CGI script without SOAP? If not, you ll need to get that to work first. Remember that CGI scripts (generally) run as the web user
            Message 5 of 10 , Jul 4, 2001
            • 0 Attachment
              Can you use DBI in a similar CGI script without SOAP? If not, you'll need to
              get that to work first.

              Remember that CGI scripts (generally) run as the web user rather than
              yourself, so you need to ensure that the web user can access your database.

              Chris

              -----Original Message-----
              From: caboose@... [mailto:caboose@...]
              Sent: Wednesday, July 04, 2001 1:40 PM
              To: soaplite@yahoogroups.com
              Subject: [soaplite] Re: DBI and SOAP::LITE


              Hmm, I just found something. DBI needs a modified LD_LIBRARY_PATH to
              run. I added this to the skript, but it still won't work.

              Are there any other ENV Variables needed? I'm stumbling in the dark.
              because there are no errors visible in the server log file.

              All other CGI / SOAP::LITE scripts work fine, so it has to be
              something DBI specific here.

              Any help?
              Sabine
            • Chris Davies
              Try including this near the top of the program: use CGI::Carp qw(fatalsToBrowser) and then (later): my $dbh =
              Message 6 of 10 , Jul 4, 2001
              • 0 Attachment
                Try including this near the top of the program:
                use CGI::Carp qw(fatalsToBrowser)

                and then (later):
                my $dbh =
                DBI->connect("DBI:mysql:database=delivery;host=brest.c-lab.de","root","") ||
                die "Cannot connect to database: $DBI::errstr";

                Ideally you'll want to catch all errors, so include {RaiseError => 1} in the
                DBI attributes, or else check each return value:
                my $sth = $dbh->prepare("SELECT * from documents WHERE name='$doc'") ||
                die "Cannot prepare SELECT statement: $DBI::errstr";
                $sth->execute() ||
                die "Cannot execute statement: $DBI::errstr";

                As I mentioned in another email, if you're having problems with a CGI script
                containing both DBI and SOAP, try isolating the problem. For example, check
                that DBI works in your CGI script, and then check that SOAP works in your
                CGI script. It's almost certainly an issue with the CGI script running
                without necessary environment variables, or under a username that doesn't
                have access to your database (or its tables).

                Chris


                -----Original Message-----
                From: caboose@... [mailto:caboose@...]
                Sent: Wednesday, July 04, 2001 1:03 PM
                To: soaplite@yahoogroups.com
                Subject: [soaplite] Re: DBI and SOAP::LITE


                Here's the script and the offending subroutine.


                #! /usr/local/perl-5.6.1/bin/perl -w
                use SOAP::Transport::HTTP;
                use DBI();

                SOAP::Transport::HTTP::CGI
                ->dispatch_to('Delivery')
                ->handle;

                package Delivery;
                sub retrieveDocument {
                my ($class, $doc, $name, $passwd) =@_;
                my $returnString="result: ";
                my $dbh =
                DBI->connect("DBI:mysql:database=delivery;host=brest.c-lab.de","root","");
                $returnString="Kein connect: $DBI::errstr";
                #my $sth = $dbh->prepare("SELECT * from documents WHERE name='$doc'");
                #$sth->execute();
                #while (my $ref= $sth->fetchrow_hashref()) {
                #$returnString.= "$ref->{'name'} - $ref->{'place'} - $ref->{'start'} -
                $ref->{'owner'} - $ref->{'date'} - $ref->{'status'}";


                #}
                #$sth->finish();
                $dbh->disconnect();
                return $returnString;
                }
              • caboose@c-lab.de
                If I could do that, I wouldn t be asking around. My problem is that the line DBI- connect ( DBI:mysql:database=delivery;host=brest.c-lab.de , root , ) never
                Message 7 of 10 , Jul 4, 2001
                • 0 Attachment
                  If I could do that, I wouldn't be asking around.
                  My problem is that the line DBI->connect
                  ("DBI:mysql:database=delivery;host=brest.c-lab.de","root","")
                  never completes execution. Whatever values (true or nonsense) I give
                  for the paramaters it does nowt. I can even put in nonsense for the
                  driver (mysql) it's still the same.

                  It never gets to the ored die part.

                  Any further line will never be exectuted. It seems to be stuck
                  somewhere in the DBI: part and never get any further.

                  Sabine

                  --- In soaplite@y..., "Chris Davies" <Chris.Davies@M...> wrote:
                  > Try including this near the top of the program:
                  > use CGI::Carp qw(fatalsToBrowser)
                  >
                  > and then (later):
                  > my $dbh =
                  > DBI->connect("DBI:mysql:database=delivery;host=brest.c-
                  lab.de","root","") ||
                  > die "Cannot connect to database: $DBI::errstr";
                  >
                  > Ideally you'll want to catch all errors, so include {RaiseError =>
                  1} in the
                  > DBI attributes, or else check each return value:
                  > my $sth = $dbh->prepare("SELECT * from documents WHERE
                  name='$doc'") ||
                  > die "Cannot prepare SELECT statement: $DBI::errstr";
                  > $sth->execute() ||
                  > die "Cannot execute statement: $DBI::errstr";
                  >
                  > As I mentioned in another email, if you're having problems with a
                  CGI script
                  > containing both DBI and SOAP, try isolating the problem. For
                  example, check
                  > that DBI works in your CGI script, and then check that SOAP works
                  in your
                  > CGI script. It's almost certainly an issue with the CGI script
                  running
                  > without necessary environment variables, or under a username that
                  doesn't
                  > have access to your database (or its tables).
                  >
                  > Chris
                  >
                  >
                  > -----Original Message-----
                  > From: caboose@c... [mailto:caboose@c...]
                  > Sent: Wednesday, July 04, 2001 1:03 PM
                  > To: soaplite@y...
                  > Subject: [soaplite] Re: DBI and SOAP::LITE
                  >
                  >
                  > Here's the script and the offending subroutine.
                  >
                  >
                  > #! /usr/local/perl-5.6.1/bin/perl -w
                  > use SOAP::Transport::HTTP;
                  > use DBI();
                  >
                  > SOAP::Transport::HTTP::CGI
                  > ->dispatch_to('Delivery')
                  > ->handle;
                  >
                  > package Delivery;
                  > sub retrieveDocument {
                  > my ($class, $doc, $name, $passwd) =@_;
                  > my $returnString="result: ";
                  > my $dbh =
                  > DBI->connect("DBI:mysql:database=delivery;host=brest.c-
                  lab.de","root","");
                  > $returnString="Kein connect: $DBI::errstr";
                  > #my $sth = $dbh->prepare("SELECT * from documents WHERE
                  name='$doc'");
                  > #$sth->execute();
                  > #while (my $ref= $sth->fetchrow_hashref()) {
                  > #$returnString.= "$ref->{'name'} - $ref->{'place'} - $ref->
                  {'start'} -
                  > $ref->{'owner'} - $ref->{'date'} - $ref->{'status'}";
                  >
                  >
                  > #}
                  > #$sth->finish();
                  > $dbh->disconnect();
                  > return $returnString;
                  > }
                • Chris Davies
                  Sorry, I m puzzled. What can t you do? You should be able to test a CGI script that performs DBI accesses without needing to include SOAP. Something trivial
                  Message 8 of 10 , Jul 4, 2001
                  • 0 Attachment
                    Sorry, I'm puzzled. What can't you do? You should be able to test a CGI
                    script that performs DBI accesses without needing to include SOAP. Something
                    trivial would do to confirm interoperability. If this simple DBI program
                    doesn't work (syntax errors excepted, of course) then it's clearly not a
                    SOAP issue and you'll need to investigate the DBI problems elsewhere.

                    use strict;
                    use CGI::Carp;
                    use DBI;

                    my $dbh = DBI->connect (...) || die "connect: $DBI::errstr";
                    my $sth = $dbh->prepare ("SELECT...") || die "prepare: $DBI::errstr";
                    $sth->execute;

                    print "Content-type: text/plain\n\n";
                    while (my $row = $sth->fetchrow_hashref) {
                    print map { "$_ = $row->{$_} } keys %$row, "\n";
                    }
                    $sth->finish;
                    $dbh->disconnect;
                    print "All done\n";
                    exit 0;
                    # E&OE of course

                    I'll pick this up again tomorrow.
                    Cheers,
                    Chris


                    -----Original Message-----
                    From: caboose@... [mailto:caboose@...]
                    Sent: Wednesday, July 04, 2001 5:23 PM
                    To: soaplite@yahoogroups.com
                    Subject: [soaplite] Re: DBI and SOAP::LITE



                    If I could do that, I wouldn't be asking around.
                    My problem is that the line DBI->connect
                    ("DBI:mysql:database=delivery;host=brest.c-lab.de","root","")
                    never completes execution. Whatever values (true or nonsense) I give
                    for the paramaters it does nowt. I can even put in nonsense for the
                    driver (mysql) it's still the same.

                    It never gets to the ored die part.

                    Any further line will never be exectuted. It seems to be stuck
                    somewhere in the DBI: part and never get any further.

                    Sabine

                    --- In soaplite@y..., "Chris Davies" <Chris.Davies@M...> wrote:
                    > Try including this near the top of the program:
                    > use CGI::Carp qw(fatalsToBrowser)
                    >
                    > and then (later):
                    > my $dbh =
                    > DBI->connect("DBI:mysql:database=delivery;host=brest.c-
                    lab.de","root","") ||
                    > die "Cannot connect to database: $DBI::errstr";
                    >
                    > Ideally you'll want to catch all errors, so include {RaiseError =>
                    1} in the
                    > DBI attributes, or else check each return value:
                    > my $sth = $dbh->prepare("SELECT * from documents WHERE
                    name='$doc'") ||
                    > die "Cannot prepare SELECT statement: $DBI::errstr";
                    > $sth->execute() ||
                    > die "Cannot execute statement: $DBI::errstr";
                    >
                    > As I mentioned in another email, if you're having problems with a
                    CGI script
                    > containing both DBI and SOAP, try isolating the problem. For
                    example, check
                    > that DBI works in your CGI script, and then check that SOAP works
                    in your
                    > CGI script. It's almost certainly an issue with the CGI script
                    running
                    > without necessary environment variables, or under a username that
                    doesn't
                    > have access to your database (or its tables).
                    >
                    > Chris
                  • caboose@c-lab.de
                    Well, I m a far as that (since about 5 min):even though I have changed the ENV Variable LD_LIBRARY_PATH DBI still cant locate libz.so. I couldn t see this
                    Message 9 of 10 , Jul 4, 2001
                    • 0 Attachment
                      Well, I'm a far as that (since about 5 min):even though I have
                      changed the ENV Variable LD_LIBRARY_PATH DBI still cant locate
                      libz.so.

                      I couldn't see this error because of the Soap Encapsulation.
                      When I moved the DB access in front of the SOAP stuff it showed up in
                      the server log.

                      So I'm bugging out Perl guru with it, tomorrow morning. Thanks for
                      trying.

                      --- In soaplite@y..., "Chris Davies" <Chris.Davies@M...> wrote:
                      > Sorry, I'm puzzled. What can't you do? You should be able to test a
                      CGI
                      > script that performs DBI accesses without needing to include SOAP.
                      Something
                      > trivial would do to confirm interoperability. If this simple DBI
                      program
                      > doesn't work (syntax errors excepted, of course) then it's clearly
                      not a
                      > SOAP issue and you'll need to investigate the DBI problems
                      elsewhere.
                      >
                      > use strict;
                      > use CGI::Carp;
                      > use DBI;
                      >
                      > my $dbh = DBI->connect (...) || die "connect: $DBI::errstr";
                      > my $sth = $dbh->prepare ("SELECT...") || die "prepare:
                      $DBI::errstr";
                      > $sth->execute;
                      >
                      > print "Content-type: text/plain\n\n";
                      > while (my $row = $sth->fetchrow_hashref) {
                      > print map { "$_ = $row->{$_} } keys %$row, "\n";
                      > }
                      > $sth->finish;
                      > $dbh->disconnect;
                      > print "All done\n";
                      > exit 0;
                      > # E&OE of course
                      >
                      > I'll pick this up again tomorrow.
                      > Cheers,
                      > Chris
                      >
                      >
                      > -----Original Message-----
                      > From: caboose@c... [mailto:caboose@c...]
                      > Sent: Wednesday, July 04, 2001 5:23 PM
                      > To: soaplite@y...
                      > Subject: [soaplite] Re: DBI and SOAP::LITE
                      >
                      >
                      >
                      > If I could do that, I wouldn't be asking around.
                      > My problem is that the line DBI->connect
                      > ("DBI:mysql:database=delivery;host=brest.c-lab.de","root","")
                      > never completes execution. Whatever values (true or nonsense) I give
                      > for the paramaters it does nowt. I can even put in nonsense for the
                      > driver (mysql) it's still the same.
                      >
                      > It never gets to the ored die part.
                      >
                      > Any further line will never be exectuted. It seems to be stuck
                      > somewhere in the DBI: part and never get any further.
                      >
                      > Sabine
                      >
                      > --- In soaplite@y..., "Chris Davies" <Chris.Davies@M...> wrote:
                      > > Try including this near the top of the program:
                      > > use CGI::Carp qw(fatalsToBrowser)
                      > >
                      > > and then (later):
                      > > my $dbh =
                      > > DBI->connect("DBI:mysql:database=delivery;host=brest.c-
                      > lab.de","root","") ||
                      > > die "Cannot connect to database: $DBI::errstr";
                      > >
                      > > Ideally you'll want to catch all errors, so include {RaiseError =>
                      > 1} in the
                      > > DBI attributes, or else check each return value:
                      > > my $sth = $dbh->prepare("SELECT * from documents WHERE
                      > name='$doc'") ||
                      > > die "Cannot prepare SELECT statement: $DBI::errstr";
                      > > $sth->execute() ||
                      > > die "Cannot execute statement: $DBI::errstr";
                      > >
                      > > As I mentioned in another email, if you're having problems with a
                      > CGI script
                      > > containing both DBI and SOAP, try isolating the problem. For
                      > example, check
                      > > that DBI works in your CGI script, and then check that SOAP works
                      > in your
                      > > CGI script. It's almost certainly an issue with the CGI script
                      > running
                      > > without necessary environment variables, or under a username that
                      > doesn't
                      > > have access to your database (or its tables).
                      > >
                      > > Chris
                    • Paul Kulchenko
                      Hi, Sabine! I m not sure that s will help, but it s not enough to specify LD_LIBRARY_PATH. YOu need to pass it to your CGI script. Documentation for
                      Message 10 of 10 , Jul 4, 2001
                      • 0 Attachment
                        Hi, Sabine!

                        I'm not sure that's will help, but it's not enough to specify
                        LD_LIBRARY_PATH. YOu need to pass it to your CGI script.
                        Documentation for SOAP::Transport::HTTP has this:

                        =item Dynamic libraries are not found

                        If you see in webserver's log file something like this:

                        Can't load
                        '/usr/local/lib/perl5/site_perl/.../XML/Parser/Expat/Expat.so'
                        for module XML::Parser::Expat: dynamic linker: /usr/local/bin/perl:
                        libexpat.so.0 is NEEDED, but object does not exist at
                        /usr/local/lib/perl5/.../DynaLoader.pm line 200.

                        and you are using Apache web server, try to put into your httpd.conf

                        <IfModule mod_env.c>
                        PassEnv LD_LIBRARY_PATH
                        </IfModule>

                        Hope it helps.

                        Best wishes, Paul.

                        --- caboose@... wrote:
                        > Well, I'm a far as that (since about 5 min):even though I have
                        > changed the ENV Variable LD_LIBRARY_PATH DBI still cant locate
                        > libz.so.
                        >
                        > I couldn't see this error because of the Soap Encapsulation.
                        > When I moved the DB access in front of the SOAP stuff it showed up
                        > in
                        > the server log.
                        >
                        > So I'm bugging out Perl guru with it, tomorrow morning. Thanks for
                        > trying.
                        >
                        > --- In soaplite@y..., "Chris Davies" <Chris.Davies@M...> wrote:
                        > > Sorry, I'm puzzled. What can't you do? You should be able to test
                        > a
                        > CGI
                        > > script that performs DBI accesses without needing to include
                        > SOAP.
                        > Something
                        > > trivial would do to confirm interoperability. If this simple DBI
                        > program
                        > > doesn't work (syntax errors excepted, of course) then it's
                        > clearly
                        > not a
                        > > SOAP issue and you'll need to investigate the DBI problems
                        > elsewhere.
                        > >
                        > > use strict;
                        > > use CGI::Carp;
                        > > use DBI;
                        > >
                        > > my $dbh = DBI->connect (...) || die "connect: $DBI::errstr";
                        > > my $sth = $dbh->prepare ("SELECT...") || die "prepare:
                        > $DBI::errstr";
                        > > $sth->execute;
                        > >
                        > > print "Content-type: text/plain\n\n";
                        > > while (my $row = $sth->fetchrow_hashref) {
                        > > print map { "$_ = $row->{$_} } keys %$row, "\n";
                        > > }
                        > > $sth->finish;
                        > > $dbh->disconnect;
                        > > print "All done\n";
                        > > exit 0;
                        > > # E&OE of course
                        > >
                        > > I'll pick this up again tomorrow.
                        > > Cheers,
                        > > Chris
                        > >
                        > >
                        > > -----Original Message-----
                        > > From: caboose@c... [mailto:caboose@c...]
                        > > Sent: Wednesday, July 04, 2001 5:23 PM
                        > > To: soaplite@y...
                        > > Subject: [soaplite] Re: DBI and SOAP::LITE
                        > >
                        > >
                        > >
                        > > If I could do that, I wouldn't be asking around.
                        > > My problem is that the line DBI->connect
                        > > ("DBI:mysql:database=delivery;host=brest.c-lab.de","root","")
                        > > never completes execution. Whatever values (true or nonsense) I
                        > give
                        > > for the paramaters it does nowt. I can even put in nonsense for
                        > the
                        > > driver (mysql) it's still the same.
                        > >
                        > > It never gets to the ored die part.
                        > >
                        > > Any further line will never be exectuted. It seems to be stuck
                        > > somewhere in the DBI: part and never get any further.
                        > >
                        > > Sabine
                        > >
                        > > --- In soaplite@y..., "Chris Davies" <Chris.Davies@M...> wrote:
                        > > > Try including this near the top of the program:
                        > > > use CGI::Carp qw(fatalsToBrowser)
                        > > >
                        > > > and then (later):
                        > > > my $dbh =
                        > > > DBI->connect("DBI:mysql:database=delivery;host=brest.c-
                        > > lab.de","root","") ||
                        > > > die "Cannot connect to database: $DBI::errstr";
                        > > >
                        > > > Ideally you'll want to catch all errors, so include {RaiseError
                        > =>
                        > > 1} in the
                        > > > DBI attributes, or else check each return value:
                        > > > my $sth = $dbh->prepare("SELECT * from documents WHERE
                        > > name='$doc'") ||
                        > > > die "Cannot prepare SELECT statement: $DBI::errstr";
                        > > > $sth->execute() ||
                        > > > die "Cannot execute statement: $DBI::errstr";
                        > > >
                        > > > As I mentioned in another email, if you're having problems with
                        > a
                        > > CGI script
                        > > > containing both DBI and SOAP, try isolating the problem. For
                        > > example, check
                        > > > that DBI works in your CGI script, and then check that SOAP
                        > works
                        > > in your
                        > > > CGI script. It's almost certainly an issue with the CGI script
                        > > running
                        > > > without necessary environment variables, or under a username
                        > that
                        > > doesn't
                        > > > have access to your database (or its tables).
                        > > >
                        > > > Chris
                        >
                        >
                        > To unsubscribe from this group, send an email to:
                        > soaplite-unsubscribe@yahoogroups.com
                        >
                        >
                        >
                        > Your use of Yahoo! Groups is subject to
                        > http://docs.yahoo.com/info/terms/
                        >
                        >


                        __________________________________________________
                        Do You Yahoo!?
                        Get personalized email addresses from Yahoo! Mail
                        http://personal.mail.yahoo.com/
                      Your message has been successfully submitted and would be delivered to recipients shortly.