Re: Tomcat 7 JDBC Connection Pool - question about usage from Java code

2014-10-28 Thread Ric Bernat
Thanks, Neven. It turns out the PostgreSQL JDBC driver does not implement the setCatalog method, so this option is not available to me. However, I went ahead and set up my own cache of connection pools (dataSource instances) in a HashMap, and configured Jersey to persist this across web servi

Re: Tomcat 7 JDBC Connection Pool - question about usage from Java code

2014-10-28 Thread Ric Bernat
Thanks, Chris. To answer your suggestion first, differing username/password didn't come into play, because I found that the PostgreSQL JDBC driver does not implement the setCatalog method to change databases on the fly in the first place. (Apparently this is optional for JDBC driver implement

Re: Tomcat 7 JDBC Connection Pool - question about usage from Java code

2014-10-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Ric, On 10/26/14 2:31 PM, Ric Bernat wrote: > Thanks, Nevin. I certainly appreciate your deep treatment of my > question/issue! > > I would like to ask for clarification about a point in your #2: > >> (2) CONTAINER-MANAGED CONNECTION POOL. (a) usi

Re: Tomcat 7 JDBC Connection Pool - question about usage from Java code

2014-10-28 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Neven, On 10/26/14 6:28 PM, Neven Cvetkovic wrote: > Hey Ric, > > Here's another thing you could do: > http://stackoverflow.com/questions/7195556/how-to-manage-connections-to-dynamically-created-databases > > If your databases are all on the same

Re: Tomcat 7 JDBC Connection Pool - question about usage from Java code

2014-10-26 Thread Neven Cvetkovic
Hey Ric, Here's another thing you could do: http://stackoverflow.com/questions/7195556/how-to-manage-connections-to-dynamically-created-databases If your databases are all on the same db instance, but different schema/database name, you could avoid connecting to the specific database name, but ra

RE: Tomcat 7 JDBC Connection Pool - question about usage from Java code

2014-10-26 Thread Ric Bernat
Thanks, Nevin. I certainly appreciate your deep treatment of my question/issue! I would like to ask for clarification about a point in your #2: > (2) CONTAINER-MANAGED CONNECTION POOL. > (a) using container injection > > @Resource(name="") > private DataSource datasource > > (b) tradition

Re: Tomcat 7 JDBC Connection Pool - question about usage from Java code

2014-10-26 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Ric, On 10/25/14 9:06 PM, Ric Bernat wrote: > Thanks. That makes sense. Pooling for the duration of that single > web service call is not our main goal. However, JAX-RS allows me > to persist objects in memory across web service calls, so I can > ke

Re: Tomcat 7 JDBC Connection Pool - question about usage from Java code

2014-10-26 Thread Neven Cvetkovic
Hey Ric, Thanks for asking these questions. Hopefully, this discussion will benefit many on this list. Here's the summary of your options obtaining connections in your application. As you suggested, database connections are typically obtained through a javax.sql.DataSource object (wrapped pool o

RE: Tomcat 7 JDBC Connection Pool - question about usage from Java code

2014-10-25 Thread Ric Bernat
not sure that I would be able to create JNDI declarations for just-created databases on the fly. Ric -Original Message- From: Konstantin Kolinko [mailto:knst.koli...@gmail.com] Sent: Saturday, October 25, 2014 3:25 PM To: Tomcat Users List Subject: Re: Tomcat 7 JDBC Connection Pool -

Re: Tomcat 7 JDBC Connection Pool - question about usage from Java code

2014-10-25 Thread Konstantin Kolinko
2014-10-26 1:49 GMT+04:00 Ric Bernat : >> There is no such method to be called like on the above line. >> "DataSource(PoolConfiguration)" is a constructor. To call a constructor you >> need the keyword "new". > > My bad: I copied some code around and dropped the "new." You are quite right: > I am

RE: Tomcat 7 JDBC Connection Pool - question about usage from Java code

2014-10-25 Thread Ric Bernat
Saturday, October 25, 2014 1:44 PM To: Tomcat Users List Subject: Re: Tomcat 7 JDBC Connection Pool - question about usage from Java code -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/25/2014 12:12 PM, Ric Bernat wrote: > I am using Tomcat 7.0.53, and I am using Tomcat JDBC connection

RE: Tomcat 7 JDBC Connection Pool - question about usage from Java code

2014-10-25 Thread Ric Bernat
urday, October 25, 2014 2:14 PM To: Tomcat Users List Subject: Re: Tomcat 7 JDBC Connection Pool - question about usage from Java code 2014-10-25 23:12 GMT+04:00 Ric Bernat : > I am using Tomcat 7.0.53, and I am using Tomcat JDBC connection > pooling to connect to multiple PostgreSQL (9.3) da

Re: Tomcat 7 JDBC Connection Pool - question about usage from Java code

2014-10-25 Thread Konstantin Kolinko
2014-10-25 23:12 GMT+04:00 Ric Bernat : > I am using Tomcat 7.0.53, and I am using Tomcat JDBC connection pooling to > connect to multiple PostgreSQL (9.3) databases. My application is a JAX-RS > (Jersey) web server application that provides a set RESTful web services (no > UI). My data layer uses

Re: Tomcat 7 JDBC Connection Pool - question about usage from Java code

2014-10-25 Thread Mark Eggers
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/25/2014 12:12 PM, Ric Bernat wrote: > I am using Tomcat 7.0.53, and I am using Tomcat JDBC connection > pooling to connect to multiple PostgreSQL (9.3) databases. My > application is a JAX-RS (Jersey) web server application that > provides a set

Tomcat 7 JDBC Connection Pool - question about usage from Java code

2014-10-25 Thread Ric Bernat
I am using Tomcat 7.0.53, and I am using Tomcat JDBC connection pooling to connect to multiple PostgreSQL (9.3) databases. My application is a JAX-RS (Jersey) web server application that provides a set RESTful web services (no UI). My data layer uses the Spring JdbcTemplate library. First, let