[ensembl-dev] Problem with using ensembl API when called via the web
Anne Parker
ap5 at sanger.ac.uk
Wed Oct 19 09:53:07 BST 2011
We were having problems yesterday afternoon with someone "spamming" the public database server with badly-optimised queries. This may well account for your database connection issues. Can you try connecting directly from a command line, and let us know if that works?
Cheers
Anne
On 19 Oct 2011, at 09:48, Andreas Kusalananda Kähäri wrote:
> Just throwing in another thought about this:
>
> The point in the code where your program breaks is just after failing
> to establish a connection to the database. There might be too many
> connections open by others for you to connect. In this case, waiting
> for others to finish fetching their data and then trying again would
> solve the problem.
>
> Kind regards,
> AKK
>
> On 19 October 2011 09:24, Andreas Kusalananda Kähäri <ak at ebi.ac.uk> wrote:
>> Hi Natascha,
>>
>> I can't see anything obviously wrong with your code. If you get as far
>> as trying to connect, all modules are most likely loaded ok.
>>
>> The environment from which the program is executing when running from
>> the command line is obviously different in some way from when you're
>> running the program via the web server, but I can't see in what way.
>> I'm wondering if proxies makes a difference on this level or not, but
>> unfortunately I'm not experienced enough with web services to make a
>> proper diagnosis.
>>
>> Are you running the web service from the same machine as when you run
>> the program from the command line? If not, do they both have the same
>> connectivity to external hosts (e.g., ensembldb)?
>>
>>
>> By the way, if you're developing a web application using the Ensembl
>> API, I would strongly advise to point it to local copies of the
>> databases, not at our public database server as this is likely to slow
>> interactiveness down for you (and possibly slow down access for our
>> other users).
>>
>>
>> Kind regards,
>> Andreas Kusalananda Kähäri
>>
>>
>> On 19 October 2011 05:44, Natascha May <natascha at tll.org.sg> wrote:
>>> Hello everyone,
>>>
>>> I am new to using the ensembl perl API (version 63). I would really
>>> appreciate some help for a problem I'm having with my perl script.
>>>
>>> The perl script basically connects to the DB and uses the slice method to
>>> retrieve some information. If I run this perl script
>>> from my terminal, it works fine, and I am able to get results from ensembl.
>>> However, if I call this perl script via a php script
>>> (because I am trying to develop a web based tool), the MySQL connection
>>> fails.
>>>
>>> Error message in httpd/error_log:
>>>
>>> DBI connect('host=ensembldb.ensembl.org;port=5306','anonymous',...) failed:
>>> Can't connect to MySQL server on
>>> 'ensembldb.ensembl.org' (13) at
>>> /var/www/cgi-bin/tll_blat/ensembl-src/ensembl/modules/Bio/EnsEMBL/Registry.pm
>>> line 1452
>>> Can't call method "selectall_arrayref" on an undefined value at
>>> /var/www/cgi-bin/tll_blat/ensembl-src/ensembl/modules/Bio/EnsEMBL/Registry.pm
>>> line 1455.
>>>
>>> I have explicitly set the location of the ensembl and perl modules at the
>>> top of my perl script as follows:
>>>
>>> use warnings;
>>>
>>> use lib '/var/www/cgi-bin/tll_blat/ensembl-src/bioperl-1.2.3';
>>> use lib '/var/www/cgi-bin/tll_blat/ensembl-src/ensembl/modules';
>>>
>>> use Bio::EnsEMBL::Registry;
>>>
>>> $registry = 'Bio::EnsEMBL::Registry';
>>> $slice='Bio::EnsEMBL::Slice';
>>> $gene='Bio::EnsEMBL::Gene';
>>>
>>> $registry->load_registry_from_db(-host => 'ensembldb.ensembl.org', -user =>
>>> 'anonymous');
>>>
>>> All this works when I run it from command line, but not via the web.
>>> Where could I be going wrong...?
>>>
>>> Thank you so much!
>>>
>>> ~ Natascha
>>>
>>> Information in this email is confidential and may also be privileged. It is
>>> intended solely for the person to whom it is addressed. If you are not the
>>> intended recipient, please notify the sender, and please delete the message
>>> and any other record of it from your system immediately.
>>>
>>> _______________________________________________
>>> Dev mailing list Dev at ensembl.org
>>> List admin (including subscribe/unsubscribe):
>>> http://lists.ensembl.org/mailman/listinfo/dev
>>> Ensembl Blog: http://www.ensembl.info/
>>>
>>>
>>
>>
>>
>> --
>> Andreas Kusalananda Kähäri, Ensembl Software Developer
>> European Bioinformatics Institute (EMBL-EBI)
>> Wellcome Trust Genome Campus, Hinxton
>> Cambridge CB10 1SD, United Kingdom
>>
>
>
>
> --
> Andreas Kusalananda Kähäri, Ensembl Software Developer
> European Bioinformatics Institute (EMBL-EBI)
> Wellcome Trust Genome Campus, Hinxton
> Cambridge CB10 1SD, United Kingdom
>
> _______________________________________________
> Dev mailing list Dev at ensembl.org
> List admin (including subscribe/unsubscribe): http://lists.ensembl.org/mailman/listinfo/dev
> Ensembl Blog: http://www.ensembl.info/
Anne Parker
Ensembl Web Production Manager
http://www.ensembl.org
More information about the Dev
mailing list