tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pid <...@pidster.com>
Subject Re: Using Tomcat7 JDBC Connection Pool
Date Wed, 08 Feb 2012 11:49:33 GMT
On 08/02/2012 11:41, amit shah wrote:
> I am trying to use the tomcat 7 jdbc connection pool in our application by
> using the tomcat-jdbc.jar and tomcat-juli.jar files. The basic connection
> pool works fine. I have few questions/clarifications
> 
> 
> 
> 1. Executing multiple statements on connection initialization
> 
>             - The pool provides a flexibility to execute a single sql query
> when the physical connection is established (initSQL property). I couldn't
> find a way to execute multiple sql queries on connection initialization.
> The JDBC Interceptor mechanism also doesn't seem to help out. Any
> suggestions?

Why do you want to execute multiple SQL statements for each connection
in the pool?  Normally you want to do the absolute minimum to validate
the connection.



> 2. alternateUserNameAllowed property
> 
> - If a connection is requested with the credentials user1/password1 and the
> connection was previously connected using user2/password2, the connection
> will be closed, and reopened with the requested credentials. This property
> was added as an enhancement to bug
> 50025<https://issues.apache.org/bugzilla/show_bug.cgi?id=50025>.
> I didn’t understand the reason behind closing the previous connection. Can
> the pool not still maintain the previous connection and open a new
> connection if the user/password combination do not match?. This way the
> same pool can be used for multiple schemas.

The old connection is closed so that the current user (who has different
credentials) can't then use that connection.

If you want to use the old connection, don't pass in new credentials.

Note: this is a pool of connections, not a single connection.


> 3. JMX & Statistics
> 
>             - How can one enable jmx when tomcat 7 jdbc connection pool is
> used independently? I tried specifying the jmx vm options
> (-Dcom.sun.management.jmxremote
> -Dcom.sun.management.jmxremote.port=1617
> -Dcom.sun.management.jmxremote.authenticate=false
> -Dcom.sun.management.jmxremote.ssl=false)
> but they don’t seem to help out? Neither did I found a way to print or
> access the pool statistics programmatically. Any suggestions?

I don't know the answer offhand, but I assume that an examination of the
source code would lead to an understanding of how Tomcat handles this.


p


-- 

[key:62590808]


Mime
View raw message