Re: Shared data source (Bug 49543)

2012-05-24 Thread Robert Anderson
Hi, Now it's working! Follows the script: 1) Tomcat 6.0.35: copy tomcat-jdbc.jar to CATALINA_HOME/lib. Tomcat 7.0.x is ready. 2) Create a global resource in CATALINA_HOME/conf/server.xml. Attributes in bold *MUST *be present: Resource name=jdbc/pgserver auth=Container

Re: Shared data source (Bug 49543)

2012-05-24 Thread Konstantin Kolinko
2012/5/24 Robert Anderson ranom...@gmail.com: Sorry, for the wall of text. :) IIRC there is no support for getConnection(username, password) in Apache Commons DBCP pool at all, and it was a new feature in Tomcat JDBC pool at that time. Yes,  it is the problem. I've lost many hours following

Re: Shared data source (Bug 49543)

2012-05-24 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Robert, On 5/24/12 7:50 AM, Robert Anderson wrote: Now it's working! Follows the script: So, how does your script deviate from the Tomcat documentation? It seems that you followed the docs and now it works. Right? - -chris -BEGIN PGP

Re: Shared data source (Bug 49543)

2012-05-24 Thread Robert Anderson
Chris, Basically, the ResourceLink documentation doesn't say that to enable shared pool with different credentials: 1) You have to add tomcat-jdbc.jar in Tomcat 6.0 classpath; 2) You have to put the attributes in global resource definition: factory=org.apache.tomcat.jdbc.pool.DataSourceFactory

Re: Shared data source (Bug 49543)

2012-05-24 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Robert, On 5/24/12 10:57 AM, Robert Anderson wrote: Chris, Basically, the ResourceLink documentation doesn't say that to enable shared pool with different credentials: 1) You have to add tomcat-jdbc.jar in Tomcat 6.0 classpath; 2) You have

Re: Shared data source (Bug 49543)

2012-05-24 Thread Robert Anderson
Exactly, I had no way of knowing because the documentation of ResourceLink does not inform these details. :) Konstantin was perfect in his description in bugzilla. On Thu, May 24, 2012 at 12:06 PM, Christopher Schultz ch...@christopherschultz.net wrote: -BEGIN PGP SIGNED MESSAGE-

Shared data source (Bug 49543)

2012-05-23 Thread Robert Anderson
Hi, I'm testing this functionality (versions 6.0.35 and 7.0.27) but it's not working for me (https://issues.apache.org/bugzilla/show_bug.cgi?id=49543 , http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Resource_Links). --server.xml GlobalNamingResources Resource

Re: Shared data source (Bug 49543)

2012-05-23 Thread Konstantin Kolinko
2012/5/24 Robert Anderson ranom...@gmail.com: Hi, I'm testing this functionality (versions 6.0.35 and 7.0.27) but it's not working for me (https://issues.apache.org/bugzilla/show_bug.cgi?id=49543 , http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Resource_Links). --server.xml

Re: Shared data source (Bug 49543)

2012-05-23 Thread Joao Silva
Hi The ResourceLink element will use the parameters name, global and type. Everything else is being ignored, as the resource link is but reference to the global shared data source. See http://tomcat.apache.org/tomcat-7.0-doc/config/context.html, searching for ResourceLink. Best regards On

Re: Shared data source (Bug 49543)

2012-05-23 Thread Robert Anderson
Hi, Thanks guys. 1. You have to wrap all this with try/finally and invoke close() on ResultSet and Statement before calling that method on Connection (which returns it to the pool, but does not actually close it). I'd have resource leaks otherwise. Cetainly, in this code I just wanted to test

Re: Shared data source (Bug 49543)

2012-05-23 Thread Robert Anderson
Hi João, This documentation also says: When the attribute factory=org.apache.naming.factory.DataSourceLinkFactorythe resource link can be used with two additional attributes to allow a shared data source to be used with different credentials. When these two additional attributes are used in

Re: Shared data source (Bug 49543)

2012-05-23 Thread Konstantin Kolinko
2012/5/24 Robert Anderson ranom...@gmail.com: 2. You need to set alternateUsernameAllowed= true on Tomcat JDBC pool  [1] Otherwise arguments in ds.getConnection(user,password) method on that datasource are ignored. Good, I'll test it. Anyway, the following description and example in

Re: Shared data source (Bug 49543)

2012-05-23 Thread Robert Anderson
Sorry, for the wall of text. :) IIRC there is no support for getConnection(username, password) in Apache Commons DBCP pool at all, and it was a new feature in Tomcat JDBC pool at that time. Yes, it is the problem. I've lost many hours following an example in documentation about ResourceLink and