ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Osbaldeston <richard.osbaldes...@wordmap.com>
Subject Re: Access to the underlying connection
Date Tue, 19 Apr 2005 15:39:01 GMT
Its a bit late for that, I've just butchered the code removing all 
traces of IBatis.. Out of interest whats the class of the returned 
connection, conn? I notice you don't close it so its likely to be 
another proxy - in which case it dosnt help as I cant create a oracle 
array descriptor using it (classcastexception).

- Richard

Brandon Goodin wrote:

>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 <richard.osbaldeston@wordmap.com> 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
>>
>>    
>>
>
>  
>


Mime
View raw message