java - Embedded Jetty 8 and configuration of JNDI MySQL connection pool with no XML -


i have been searching while now, , not able find tutorials or answers question.

in project there 1 xml-file, pom.xml, server embedded jetty 8, programmatically defined servletcontexthandler handles incoming requests. point is, no webappcontext or war-file(as seems tutorials expect web-inf, webappcontext, web.xml, jetty-env.xml or war file).

i want add jndi-datasource pooling sql-connections programmatically in java. there point me tutorial, or give tips on how achieve this?

you have chosen embedded-jetty special servletcontexthandler without complete web container (that's not meant criticism, path have followed far).

if target environment well, why need jndi on top of this? has provide jndi implementation. add connection pool bonecp, c3po etc. , use without jndi.

on other hand, if target environment requires use connection pool, can add own method on top of both providers:

pseudo code:

public class myconnectionfactory  // replaced property lookup etc. private boolean development = true;  public connection getconnection(string jndiname)   if (development)     // connection bonecp etc. (ignore jndiname)   else {     // lookup data source using jndi, connection 

and in source use method.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -