-----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 db instance, but different 
> schema/database name, you could avoid connecting to the specific
> database name, but rather set that up on the connection object,
> e.g.
> 
> @Resource(name="....") private DataSource datasource;
> 
> public void someMethod() {
> 
> try ( Connection c = datasource.getConnection(); 
> c.setCatalog("dynamic_dbname"); PreparedStatement ps =
> c.prepareStatement("SOME SQL HERE"); ) { ... } catch (SQLException
> sqle) { ... }
> 
> }
> 
> I haven't tried this myself, but I guess this could work. Off
> course, working with Spring JdbcTemplate makes it even nicer :))
> 
> How long do these dbs live? How often do you create them? Why do
> you have a need for that many databases? etc...

I wouldn't be surprised if the credentials are different for each
database. In that case, I don't believe connection-pooling retains all
its advantages because a reconnect is required to change user identities.

Managing separate pools may be in order, here.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJUT3oBAAoJEBzwKT+lPKRYqnEP/3zEMvHthq29fvTfZHDO34Ot
cRR+lbQus/e9cM362VJMaF4XnqU+Iq1mqLuhCPqN0m+niQN7P9vJLEph1lV7f5lC
YEZyaiu/JG6ZnfncunqNOQoeYi4Wp/9cTov1uelBlUqj5aAbrrwypP4IbsqhxHsA
IrG5pPAVx2sw1TodaH+tuu4zVFM4uCZdQKWxGwycwfkfhx7rm6p/0bLUnPo+FUW/
lpLUQokqX86u0uHUDqoeCviycD2bpOND+6X+NvdhW1Y678eLmmgg0c9pE7yzmHPl
/dw0WELg0OAZVnwxPZV0xvHnGi7rPDZZ5xYXs36H83aw1kE6+3xuUPJOY73z9c3c
5kajoMJ1tdB9EEYsTpImrTK3BzQHMgxDP6glvE00l5LUid7opE9Gd7yS7AR94kuA
W1cNF3H1hHUEVUtmfQsEq01qQ6WWNzCh3vh0DyIzOsgVoZwc1prfC4N50frH74a2
H5Yf1w5tPu04zP19D0Rzen4oO5rsSQLc7TnERSX/jp0FQWyQGTM+IdO/vbYNVpU9
YIpsKWP+Mp+R28k+RZcLIQqlHgRjJfZfB4aQAguFG7aUiF8BIHQ/irD1ZBNAtxDg
rgF78iMEqOfBWiMYORFOzM1NFwQYyte31YDFyjsnEe9u9FCZNFfUsAiJlRQx0N0S
WBZSBQTOOpm1JdgBsq1C
=01r1
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to