Richard,
If you configure your oracle datasrouce via JNDI you should have no
problem accomplishing what you want.
Example:
public class JdbcAccountDao extends JdbcDaoTemplate implements AccountDao {
...
public JdbcAccountDao(DaoManager daoManager) {
super(daoManager);
}
...
public Account findAccount(int id) {
Account account = null;
Connection conn = getConnection();
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement(SELECT);
ps.setInt(1, id);
rs = ps.executeQuery();
while (rs.next()) {
account = new Account();
account.setId(rs.getInt("id"));
account.setFirstName(rs.getString("firstName"));
account.setLastName(rs.getString("lastName"));
account.setEmailAddress(rs.getString("emailAddress"));
}
} catch (SQLException e) {
throw new DaoException("Error finding Account. Cause: " + e, e);
} finally {
closeResultSet(rs);
closePreparedStatement(ps);
}
return account;
}
...
}
Brandon
On 4/19/05, Richard Osbaldeston <[EMAIL PROTECTED]> wrote:
> Brandon Goodin wrote:
>
> >I thought Oracle has a pooled connection datasource. Would it be
> >possible to use oracle's datasource via JNDI? I would think that their
> >implementation would provide what you need.
> >
> >Brandon
> >
> >
> Hmmm, only if I could still get hold of the 'real' connection and not
> the proxy that IBatis returns (I guess so the IBatis developer dosnt
> have to worry about closing it correctly). But the fact that they'res
> more than one way to configure the datasources strongly suggests I'm
> barking up the wrong tree with the bugs in SimpleDataSource.. if the
> user configures a different datasource the same problem will re-occur.
> Guess there's just too much Oracle in this equation.. I'll have to drop
> IBatis from this project. Shame (and a lot of back-pedalling on my account).
>
> - Richard
>