Dear removeps-groups,

How to configure JNDI in order to avoid the error "Last packet sent to the server was xxxxx ms ago."? I've seen two other errors which seem to be from the same cause: "Communications link failure" and "Connection.close90 has already been called".

This is what I've come up with, but wonder if it is is good and efficient:

 <Resource name="jdbc/myname"
           auth="Container"
           type="javax.sql.DataSource"
           driverClassName="my.custom.mysql.Driver"
           url="[EMAIL PROTECTED]:mysql://localhost:3306"
           username="user"
           password="encode:abcdefg"
initialSize="1" maxActive="15" maxIdle="15" minEvictableIdleTimeMillis="43200000" maxWait="5000" removeAbandoned="true" removeAbandonedTimeout="30" logAbandoned="true" testOnBorrow="true" testWhileIdle="true" validationQuery="select 1"/>


The my.custom.mysql.Driver class decodes and decrypts the password, and passes these to the base class, which is com.mysql.jdbc.NonRegisteringDriver.

Hmm. Lots of trouble for a file that you can just chmod 600 to avoid this whole issue. But that's just how I do this.

You realize of course that this precisely as safe as storing a plain- text password. I mean, if I can read this file with the encrypted password, I can see that you use a non-standard MySQL driver. So I would just download the contents of your Tomcat's lib directories. I presume they have the same directory and file permissions as the data source config file.

I don't care what the password is. I just copy your config, plop the contents of your Tomcat's lib dir into mine and I can connect to your database just fine.

I read that the validationQuery="select 1" validates the connection before returning it to the user. If the select statement fails, then the connection is removed from the pool and a new one is created.

What I'm not sure is if I need the testOnBorrow="true" and testWhileIdle="true".

Here is how I dealt with that issue: http://java-monitor.com/forum/showthread.php?t=70 You can see my config file in the last post of the thread.

I found you need only testWhenIdle. I set it to once a minute, so that I never have stale connections in the pool, thus the issue of dealing with them never comes up. I have been running like this for months and seen no issues since.

No overhead that I notice, but I'd love to see some scientific measurements from you to prove me wrong. From anyone, for that matter. ;-)
--
Kees Jan

http://java-monitor.com/forum/
[EMAIL PROTECTED]
06-51838192

Human beings make life so interesting. Do you know that in a universe so full of wonders, they have managed to invent boredom. Quite astonishing... -- Terry Partchett


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to