Re: MySQL connection problems on Tomcat



On Jun 20, 11:04 am, Hakan <H...@xxxxxxxxxxxx> wrote:
My web start application connects to a MySQL database through a
servlet. The servlet accesses the database through a MySQL connector
instance and returns the results the client if necessary. Everything is
done through a Tomcat Linux web server.

My problems seem to occur when I run the program through the servlet
for the first time after a while, like the first time of the day or
after not testing it on the server for some days. It can't fetch
anything from the database, so the client just gets null objects back.
Ultimately, a NullPointerException kills the application as it has
nothing to work with.

The solution is very simple. I shut down Tomcat and restart it, after
which it again reads results from the database as it should. This is
just not a sustainable way to deal with it.

My employer wants to deploy it such that many different users will have
an interest in accessing it from various places and not just people with
system administrator privileges. Hence, crashes are liable to make them
spurn the application. That would make quite a lot of work useless.

Do you know the source of the mentioned problem?

Regards.

--
Newsoffice.de - Die Onlinesoftware zum Lesen und Schreiben im Usenet
Die Signatur läßt sich nach Belieben anpassen ;-)

I'm guessing the 'connector' has a simple JDBC connection underneath,
which is killed after a time of idleness, perhaps by a firewall or
a DBMS setting for idle sessions. One simple hack would be to store
each successful time-of-use in the servlet, and at each invoke,
compare the current time to the last successful use, and if it
hasn't been used for an hour (experiment to find the right value)
you must re-create connector. I'd see about the DBMS parameters
that might be killing the connection out from under you.
HTH,
Joe Weinstein at Oracle
.



Relevant Pages

  • Re: Database Diagram 15 ruled column limit?
    ... Basically, you drag an Entity shape onto the page, and then use the Database ... Relationship connector to join them. ... columns in the Database Propoerties window. ...
    (microsoft.public.visio)
  • Re: Database Diagram 15 ruled column limit?
    ... Basically, you drag an Entity shape onto the page, and then use the Database ... Relationship connector to join them. ... rows) with looks a lot like a db diagram would. ... columns in the Database Propoerties window. ...
    (microsoft.public.visio)
  • Re: Did I just kill my new pinball game?
    ... problem the first time is a red herring. ... connector (I don't have the steadiest hands ever for small work like ... flipper since you happen to hit that first. ...
    (rec.games.pinball)
  • Re: Controling position of Text in connectors
    ... the attributes of the shapes are saved in an Access database. ... connector it was associated with. ... Visio totally ignored the 2 following ... the exact same path that the user had originally drawn them in. ...
    (microsoft.public.visio.developer.vba)
  • Re: [opensuse] openoffice java
    ... have at least one thing running (funambol) that requires this version or ... better of the connector,. ... I use rekall to manage my database. ...
    (SuSE)