Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000358 [Resin] minor always 08-18-05 00:00 11-30-05 14:42
Reporter user356 View Status public  
Assigned To
Priority normal Resolution fixed  
Status closed   Product Version 3.0.14
Summary 0000358: Expected OraclePreparedStatement not returned from resin pool
Description RSN-402
In earlier versions of resin (3.0.6), a pooled connection returned from an oracle pool configured as below, returned (and still does) the expected OraclePreparedStatemnt or OraclePreparedCall. Once upgrading to 3.0.14, it seems a wrapper of some type is returned instead (com.caucho.sql.UserPreparedStatement). The casting is necessary to use oracle specific methods on the returned class for XML parameter handling. Is their a work-around for this (while still using the resin pooling mechanism)? Some method that returns the underlying object retruned from the driver?

DB pool config (web.xml)

    <database>
      <jndi-name>jdbc-pool</jndi-name>
      <driver type="oracle.jdbc.pool.OracleConnectionPoolDataSource">
        <url>jdbc:oracle:thin:@sauron:1521:epow</url>
        <user>epow</user>
        <password>epow</password>
      </driver>
      <prepared-statement-cache-size>8</prepared-statement-cache-size>
      <max-connections>5</max-connections>
      <max-idle-time>30s</max-idle-time>
    </database>

Relevant JSP Code:

<%!
    private DataSource pool = null;

    public void jspInit() {

        try {
            javax.naming.Context env = ( javax.naming.Context ) new InitialContext().lookup("java:comp/env");
            pool = ( DataSource ) env.lookup( "jdbc-pool" );
            if ( pool == null )
                System.err.println( " ERROR: Unknown Data Source." );
        } catch ( NamingException e ) {
            e.printStackTrace();
        }
    }

    public void updateMember( Member member ) {
        Connection c = null;

        try {
            c = pool.getConnection();
            // Following line causes ClassCastException now
            OraclePreparedStatement s = ( OraclePreparedStatement ) c.prepareStatement(
                    "UPDATE member SET profile = ? WHERE member_id = ?" );
            s.setOPAQUE( 1, XMLType.createXML( c, member.getCustomDataXML() ) );
            s.setInt( 2, member.getMemberId() );
        } catch( Exception e ) {
            e.printStackTrace();
        } finally {
            try {
                if( c != null )
                    c.close();
            } catch( Exception e ) {
            }
        }
    }
%>

Exception now thrown:


java.lang.ClassCastException: com.caucho.sql.UserPreparedStatement
        at _jsp._pooltest__jsp.updateMember(_pooltest__jsp.java:52)
        at _jsp._pooltest__jsp._jspService(_pooltest__jsp.java:88)
        at com.caucho.jsp.JavaPage.service(JavaPage.java:60)
        at com.caucho.jsp.Page.pageservice(Page.java:570)
        at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:159)
        at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:163)
        at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:208)
        at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:259)
        at com.caucho.server.port.TcpConnection.run(TcpConnection.java:363)
        at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:490)
        at com.caucho.util.ThreadPool.run(ThreadPool.java:423)
        at java.lang.Thread.run(Thread.java:595)


Thanks.
Additional Information Solaris / Oracle 9i / Resin
Attached Files

- Relationships

- Notes
(0000414)
ferg
08-18-05 00:00

Added getPreparedStatement() to com.caucho.sql.UserPreparedStatement.
 

- Issue History
Date Modified Username Field Change
08-18-05 00:00 user356 New Issue
11-30-05 00:00 administrator Fixed in Version  => 3.0.15
11-30-05 14:42 ferg Status resolved => closed


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
33 total queries executed.
27 unique queries executed.
Powered by Mantis Bugtracker