Thanks Jimmy,

sorry that my question was not really clear. You're right, i want/need to
access the Sybase Implementation
of the ResultSet which i expected to be accessible from
getInnermostDelegate().

I tried a little bit with the idea of you're code below but got stuck in a
really strange (maybe more java-specific)
situation.

Below you'll see a code snippet:

      ...
180   result = stmt.executeQuery( "select contentdata from
cmsobject_contents where objectid = '" + objectID + "' and contentversion =
" + version );
      ...
184   if ( log.isDebugEnabled() ) {
185         log.debug( "[streamCMSObjectContentData] type if result is '" +
result.getClass().getName() + "'" );
186   }
187   org.apache.tomcat.dbcp.dbcp.DelegatingResultSet dres =
(org.apache.tomcat.dbcp.dbcp.DelegatingResultSet)result;
188   Object ires = dres.getInnermostDelegate();
189   if ( log.isDebugEnabled() ) {
190         log.debug( "[streamCMSObjectContentData] innermost result type
is '" + ires + "'" );
191         log.debug( "[streamCMSObjectContentData] innermost result class
is '" + ires.getClass().getName() + "'" );
192   }
193   com.sybase.jdbc2.jdbc.SybResultSet sres =
(com.sybase.jdbc2.jdbc.SybResultSet)ires;
      ...

The output generated by this code is:

... [streamCMSObjectContentData] type if result is
'org.apache.tomcat.dbcp.dbcp.DelegatingResultSet'
... [streamCMSObjectContentData] innermost result type is
'[EMAIL PROTECTED]'
... [streamCMSObjectContentData] innermost result class is
'com.sybase.jdbc2.jdbc.SybResultSet'
java.lang.ClassCastException
        at
com.gfk.cms4u.client.content.CMSObjectContentDAO.streamCMSObjectContentData(CMSObjectContentDAO.java:193)
        at
com.gfk.cms4u.client.content.CMSObjectContentDAO.updateCMSObjectContent(CMSObjectContentDAO.java:562)
        at
com.gfk.cms4u.client.delegate.ClientDelegateDAO.updateCMSObjectContent(ClientDelegateDAO.java:1134)
        at
com.gfk.cms4u.cms.struts.action.WorkareaDispatchContentAction.updateDocumentContent(WorkareaDispatchContentAction.java:387)
        at
com.gfk.cms4u.cms.struts.action.WorkareaDispatchContentAction.update(WorkareaDispatchContentAction.java:118)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:276)
        at
org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:196)
        at
org.apache.struts.actions.MappingDispatchAction.execute(MappingDispatchAction.java:171)
        at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
        at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
        at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
        at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
        at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
        at
org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:392)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
        at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
        at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
        at java.lang.Thread.run(Thread.java:534)

So can anybody help and explain how an object reference can return
'[EMAIL PROTECTED]' and is NOT castable to
'com.sybase.jdbc2.jdbc.SybResultSet' ?




                                                                       
             Jimmy Ray                                                 
             <[EMAIL PROTECTED]                                         
             .com>                                                      An
                                        Tomcat Users List              
             12.04.2005 17:26           <[email protected]>
                                                                     Kopie
                                                                       
              Bitte antworten                                        Thema
                    an                  Re: DBCP/JDBC Problems with    
               "Tomcat Users            DelegatingResultSet            
                   List"                                               
             <[EMAIL PROTECTED]                                         
              rta.apache.org>                                          
                                                                       
                                                                       
                                                                       




Do you mean that perhaps you are trying to access
SYBASE specific JDBC extensions?  If so, then you need
the "inner most delegate" connection.  I did this with
Oracle:

I also had this parameter in my JNDI declaration in
the server.xml...

<parameter>

<name>accessToUnderlyingConnectionAllowed</name>
        <value>true</value>
      </parameter>

Then I used this static method that I wrote.  Just
pass in the JNDI data source name.  BUT...be careful,
DO NOT close this underlying connection, or your next
call will have the overhead of recreating the
underlying connection object for DBCP:

public static synchronized Connection
getDelegatingConnection(
            String dataSource) throws
SQLException,NamingException,Exception {

        final String JNDI_LOOKUP = "java:comp/env";

        Connection conn = null;
        OracleConnection oc = null;

        Context initCtx = new InitialContext();
        Context envCtx = (Context)
initCtx.lookup(JNDI_LOOKUP);

        if (envCtx == null) {
            throw new Exception("No
EnvironmentContextException");
        }

        DataSource ds = (DataSource)
envCtx.lookup(dataSource);
        if (ds == null) {
            throw new Exception("No
DatasourceException");
        }

        ((BasicDataSource)
ds).setAccessToUnderlyingConnectionAllowed(true);

        conn = ds.getConnection();
        if (conn == null) {
            throw new Exception("No
ConnectionException");
        }

        Connection dconn = ((DelegatingConnection)
conn).getInnermostDelegate();

        if (dconn == null) {
            throw new Exception("No
DelegatingConnectionException");
        }

        conn.close();
        conn=null;

        return dconn;
    }

Regards,

Jimmy Ray
--- [EMAIL PROTECTED] wrote:
>
>
>
>
> Hello,
>
> I need some help accessing low level routines using
> JDNI based connection
> pooling provided by tomcat.
>
> Environment:      J2SE 1.4.2
> Tomcat:     5.5
> JDBC-Driver:      Sybase JConnect 5.5 (TDS)
>
> The Tomcat is configured to provide a small
> connection pool.
>
> Within my servlet i need access to the low-level
> implementation of the
> ResultSet from Sybase.
> The problem is, that the following code:
>
> Connection conn = dataSource.getConnection();
> Statement stmt = conn.getConnection();
> ResultSet result = stmt.executeQuery( "..." );
>
> System.out.println( result.getClass().getName() );
>
> prints
> org.apache.tomcat.dbcp.dbcp.DelegatingResultSet.
>
> I couldn't find a api documentation for this class
> nor could i find the jar
> file providing this class
> at all in the tomcat installation directory.
>
> Can anyone give a hint in which JAR archive this
> class can be found ?
>
>
>
> Mit freundlichen Gr��en / Kind regards
> Sebastian Wiemer
>
> ------------------------------------
> Sebastian Wiemer
> GfK Group
> Data Services GmbH
> Nordwestring 101
> D-90319 N�rnberg
> Fon: +49 (0) 911 395 3876
> Fax: +49 (0) 911 333 796
> [EMAIL PROTECTED]
> www.gfk.de / www.gfk.com
> ------------------------------------
>
>
>
> _________________________
>
> Diese E-Mail (ggf. nebst Anhang) enth�lt
> vertrauliche und/oder rechtlich
> gesch�tzte Informationen. Wenn Sie nicht der
> richtige Adressat sind, oder
> diese E-Mail irrt�mlich erhalten haben, informieren
> Sie bitte sofort den
> Absender und vernichten Sie diese Mail. Das
> unerlaubte Kopieren sowie die
> unbefugte Weitergabe dieser Mail ist nicht
> gestattet.
>
> This e-mail (and any attachment/s) contains
> confidential and/or privileged
> information. If you are not the intended recipient
> (or have received this
> e-mail in error) please notify the sender
> immediately and destroy this
> e-mail. Any unauthorised copying, disclosure or
> distribution of the
> material in this e-mail is strictly forbidden.
> _________________________
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
>



__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to