commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Steitz (JIRA)" <>
Subject [jira] Commented: (DBCP-309) First example for FSContext is invalid
Date Sun, 29 Nov 2009 21:53:20 GMT


Phil Steitz commented on DBCP-309:

Looks like a bug in the examples to me.  Looks like the BasicDataSource example is taken from
an example (Tomcat?) where a more general type of resource is being created but not bound
directly into the JNDI context.  Unless I am missing something, it would be simpler (and correct)
to just create the datasource instance and bind it directly.

> First example for FSContext is invalid
> --------------------------------------
>                 Key: DBCP-309
>                 URL:
>             Project: Commons Dbcp
>          Issue Type: Bug
>    Affects Versions: 1.2.2
>            Reporter: Ondrej Tisler
>            Priority: Trivial
> First example on page is invalid,
with this code every call of  
>   InitialContext ic2 = new InitialContext();
>   DataSource ds = (DataSource) ic2.lookup("jdbc/basic");
>   Connection conn = ds.getConnection();
>   conn.close();
> ends with new datasource with unclosed connection in it becase new Reference("javax.sql.DataSource",
 "org.apache.commons.dbcp.BasicDataSourceFactory", null); reference creates new DataSource
instead using created one while calling  ic2.lookup("jdbc/basic").
> At the end it ends with many opened connections to DB until JVM is ended.
> Second example I didn't test, i use direct aproach with manualy creating SharedPoolDataSource
and registring it in FSContext JNDI itself.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message