Ficou legal isso?
http://mentawai.lohis.com.br/connfilter.jsp
Solução marota:
public C3P0ConnectionHandler(String driver, String url, String user, String pass) {
Class klass = null;
try {
klass = Class.forName("com.mchange.v2.c3p0.ComboPooledDataSource");
} catch(ClassNotFoundException e) {
throw new IllegalStateException("C3P0 cannot be found! You probably did not put the C3P0 jars in your /WEB-INF/lib directory!");
}
try {
Class.forName(driver);
} catch(ClassNotFoundException e) {
throw new IllegalStateException("Cannot find jdbc driver " + driver + "! You probably did not put your JDBC driver in your /WEB-INF/lib directory!");
}
try {
Object cpds = klass.newInstance();
setValue(cpds, "driverClass", driver);
setValue(cpds, "user", user);
setValue(cpds, "password", pass);
setValue(cpds, "jdbcUrl", url);
this.cpds = (DataSource) cpds;
} catch(Exception e) {
throw new RuntimeException("Error trying to setup a C3P0 pooled data source:" + e.getMessage());
}
}
Fiz a inicialização por reflection, daí não preciso linkar o jar de 500K junto com o Mentawai, ou seja, tudo compila sem nenhuma dependencia externa.
Como é que a galera do C vive sem reflection?

