Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to fetch data from a temp table

    Good morning Isomorphic,

    I am having a datasource related issue. See below for details.

    Version

    GWT v2.4
    SmartGWT 3.1d EE, (full version is SNAPSHOT_v8.3d_2012-07-23/PowerEdition Deployment (built 2012-07-23) )
    Browser: IE9
    Environment: Eclipse Indigo
    Java 1.7
    Informix v11.50

    Problem

    I have to call a sequence of stored procedures, one of which writes to my_temp_table.
    I then need to fetch the data from my_temp_table.
    However, I am not able to do any fetches from my_temp_table.

    The error that appears is the following:
    "The specified table (my_temp_table) is not in the database."

    There is another application that is being used (not a webapp). By using POJC (Plain Old Java Code) I am able to use a java.sql.connection to the database and using this connection I can do the following:

    Execute java.sql.CallableStatements which will cause the sequence of stored procedures in our database to execute.
    Fetch from my_temp_table which is now visible to me in this scenario because all of the database interaction, calling the stored procedures and fetching from my_temp_table are done on the same connection.

    DS in Question

    There are two operations that are being used in the DS.

    Add1
    This calls a stored procedure (myProcedure()), which does the same thing as add2 below.

    Add2
    This uses CDATA to create a temporary table (my_temp_table), and then selects data from my_temp_table

    Both operations throw the same exception:
    “The specified table (my_temp_table) is not in the database.”

    My Questions are:
    1) How can I do the same thing that the POJC does using a SmartGwt datasource?
    2) Why can’t the SmartGwt DS that I have defined above, fetch data from the my_temp_table?


    The datasource (myTestDS) is included below as follows:

    Code:
     
    
    <DataSource              ID="myTestDS" 
                       serverType="sql"
                        tableName="myTable">  
    
     <fields>
      
        <field name="myNumber"   nativeName="my_nbr"   type="long"  hidden="true" primaryKey="true" >
          <customSelectExpression>
             myTable.my_nbr 
         </customSelectExpression>
       </field>
    
    </fields>
    
      <operationBindings>
        
         <operationBinding operationType="add"  operationId="add1"
            <customSQL>
               <![CDATA[
                 execute procedure myProcedure();
               ]]>  
               <!-- call myProcedure(); -->
               <!-- execute procedure myProcedure(); -->
           </customSQL>
        </operationBinding>
    
    
         <operationBinding operationType="add"  operationId="add2"
            <customSQL>
               <![CDATA[
                 SELECT myTable.my_nbr FROM myTable
                                                    INTO TEMP my_temp_table;
                 SELECT * FROM my_temp_table;
              ]]>         
           </customSQL>
        </operationBinding>
        
      </operationBindings>
    
    </DataSource>
    Any feedback would be greatly appreciated in this matter. Thank you for your assistance.

    #2
    Two initial possibilities to check:

    1. you've given SmartGWT different DB credentials from those used in your POJC

    2. you're sending two requests separately instead of queued (see QuickStart Guide), or you've got automatic transaction management off, both of which would mean that the same connection would not be used

    If you need more help, please show the complete server log for the failing request(s).

    Comment


      #3
      Thanks a lot for your quick response. Here is the server log from operationId="add2"

      === 2013-02-22 14:53:33,520 [l0-4] INFO RequestContext - URL: '/triad40/sc/skins/Graphite/images/Scrollbar/vthumb_Over_stretch.png', User-Agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; KB974488)': MSIE with Accept-Encoding header, ready for compressed JS
      === 2013-02-22 14:53:33,520 [l0-3] INFO RequestContext - URL: '/triad40/sc/skins/Graphite/images/Scrollbar/vthumb_Over_end.png', User-Agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; KB974488)': MSIE with Accept-Encoding header, ready for compressed JS
      === 2013-02-22 14:53:33,520 [l0-0] INFO RequestContext - URL: '/triad40/sc/skins/Graphite/images/Scrollbar/vthumb_Over_start.png', User-Agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; KB974488)': MSIE with Accept-Encoding header, ready for compressed JS
      === 2013-02-22 14:53:34,158 [l0-4] INFO RequestContext - URL: '/triad40/sc/skins/Graphite/images/button/button_Over_start.png', User-Agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; KB974488)': MSIE with Accept-Encoding header, ready for compressed JS
      === 2013-02-22 14:53:34,159 [l0-0] INFO RequestContext - URL: '/triad40/sc/skins/Graphite/images/button/button_Over_stretch.png', User-Agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; KB974488)': MSIE with Accept-Encoding header, ready for compressed JS
      === 2013-02-22 14:53:34,159 [l0-3] INFO RequestContext - URL: '/triad40/sc/skins/Graphite/images/button/button_Over_end.png', User-Agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; KB974488)': MSIE with Accept-Encoding header, ready for compressed JS
      === 2013-02-22 14:53:34,574 [l0-0] INFO RequestContext - URL: '/triad40/sc/skins/Graphite/images/button/button_Down_stretch.png', User-Agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; KB974488)': MSIE with Accept-Encoding header, ready for compressed JS
      === 2013-02-22 14:53:34,574 [l0-4] INFO RequestContext - URL: '/triad40/sc/skins/Graphite/images/button/button_Down_end.png', User-Agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; KB974488)': MSIE with Accept-Encoding header, ready for compressed JS
      === 2013-02-22 14:53:34,575 [l0-3] INFO RequestContext - URL: '/triad40/sc/skins/Graphite/images/button/button_Down_start.png', User-Agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; KB974488)': MSIE with Accept-Encoding header, ready for compressed JS
      === 2013-02-22 14:53:34,774 [l0-0] INFO RequestContext - URL: '/triad40/sc/IDACall', User-Agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; KB974488)': MSIE with Accept-Encoding header, ready for compressed JS
      === 2013-02-22 14:53:34,774 [l0-0] DEBUG IDACall - Header Name:Value pair: Accept:*/*
      === 2013-02-22 14:53:34,774 [l0-0] DEBUG IDACall - Header Name:Value pair: Referer:http://127.0.0.1:8888/Triad40.html?gwt.codesvr=127.0.0.1:9997
      === 2013-02-22 14:53:34,775 [l0-0] DEBUG IDACall - Header Name:Value pair: Accept-Language:en-US,zh-CN;q=0.7,zh-TW;q=0.3
      === 2013-02-22 14:53:34,775 [l0-0] DEBUG IDACall - Header Name:Value pair: User-Agent:Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; KB974488)
      === 2013-02-22 14:53:34,775 [l0-0] DEBUG IDACall - Header Name:Value pair: Accept-Encoding:gzip, deflate
      === 2013-02-22 14:53:34,775 [l0-0] DEBUG IDACall - Header Name:Value pair: Host:127.0.0.1:8888
      === 2013-02-22 14:53:34,775 [l0-0] DEBUG IDACall - Header Name:Value pair: Connection:Keep-Alive
      === 2013-02-22 14:53:34,775 [l0-0] DEBUG IDACall - Header Name:Value pair: Cookie:isc_cState=ready; JSESSIONID=p86spa25lo9y
      === 2013-02-22 14:53:34,775 [l0-0] DEBUG IDACall - Header Name:Value pair: Content-Type:application/x-www-form-urlencoded; charset=UTF-8
      === 2013-02-22 14:53:34,775 [l0-0] DEBUG IDACall - Header Name:Value pair: Content-Length:2147
      === 2013-02-22 14:53:34,775 [l0-0] DEBUG IDACall - Header Name:Value pair: Cache-Control:no-cache
      === 2013-02-22 14:53:34,775 [l0-0] DEBUG IDACall - session exists: p86spa25lo9y
      === 2013-02-22 14:53:34,775 [l0-0] DEBUG IDACall - remote user: null
      === 2013-02-22 14:53:34,779 [l0-0] DEBUG XML - Parsed XML from (in memory stream): 2ms
      === 2013-02-22 14:53:34,786 [l0-0] DEBUG RPCManager - Processing 1 requests.
      === 2013-02-22 14:53:34,790 [l0-0] DEBUG RPCManager - Request #1 (DSRequest) payload: {
      values:{
      id:125,
      subscriberNumber:21741,
      serviceClassName:"VIDEO - VOD ",
      blankField:" ",
      chargePerMonth:0,
      parent:5,
      numberOfUnits:1,
      serviceName:"FISND",
      serviceDescription:"SUNDANCE ON DEMAND"
      },
      operationConfig:{
      dataSource:"subscriberAssignedServicesDS",
      operationType:"add"
      },
      componentId:"isc_ListGrid_0",
      useStrictJSON:true,
      appID:"builtinApplication",
      operation:"add2",
      oldValues:{
      id:125,
      subscriberNumber:21741,
      serviceClassName:"VIDEO - VOD ",
      blankField:" ",
      chargePerMonth:0,
      parent:5,
      numberOfUnits:1,
      serviceName:"FISND",
      serviceDescription:"SUNDANCE ON DEMAND"
      },
      criteria:{
      }
      }
      === 2013-02-22 14:53:34,790 [l0-0] INFO IDACall - Performing 1 operation(s)
      === 2013-02-22 14:53:34,790 [l0-0] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null
      === 2013-02-22 14:53:34,790 [l0-0] DEBUG DeclarativeSecurity - DataSource subscriberAssignedServicesDS is not in the pre-checked list, processing...
      === 2013-02-22 14:53:34,790 [l0-0] DEBUG AppBase - [builtinApplication.add2] No userTypes defined, allowing anyone access to all operations for this application
      === 2013-02-22 14:53:34,791 [l0-0] DEBUG AppBase - [builtinApplication.add2] No public zero-argument method named '_add2' found, performing generic datasource operation
      === 2013-02-22 14:53:34,792 [l0-0] INFO SQLDataSource - [builtinApplication.add2] Performing add operation with
      criteria: {id:125,subscriberNumber:21741,serviceClassName:"VIDEO - VOD ",blankField:" ",chargePerMonth:0,parent:5,numberOfUnits:1,serviceName:"FISND",serviceDescription:"SUNDANCE ON DEMAND"} values: {id:125,subscriberNumber:21741,serviceClassName:"VIDEO - VOD ",blankField:" ",chargePerMonth:0.0,parent:5,numberOfUnits:1,serviceName:"FISND",serviceDescription:"SUNDANCE ON DEMAND"}
      === 2013-02-22 14:53:34,794 [l0-0] DEBUG SQLValuesClause - [builtinApplication.add2] Sequences: {}
      === 2013-02-22 14:53:34,805 [l0-0] DEBUG SQLConnectionManager - [builtinApplication.add2] Returning borrowed connection '51801608'
      === 2013-02-22 14:53:34,805 [l0-0] DEBUG SQLTransaction - [builtinApplication.add2] Started new Informix transaction "51801608"
      === 2013-02-22 14:53:34,805 [l0-0] DEBUG SQLDriver - [builtinApplication.add2] About to execute SQL update in 'Informix' using connection'51801608'
      === 2013-02-22 14:53:34,805 [l0-0] INFO SQLDriver - [builtinApplication.add2] Executing SQL update on 'Informix': SELECT services.service_nbr FROM services
      INTO TEMP services_temp;
      SELECT * FROM services_temp;
      === 2013-02-22 14:53:34,854 [l0-0] DEBUG SQLDriver - [builtinApplication.add2] FAILED to execute SQL update in 'Informix' using connection'51801608'
      === 2013-02-22 14:53:34,857 [l0-0] WARN RequestContext - dsRequest.execute() failed:
      java.sql.SQLException: The specified table (services_temp) is not in the database.
      at com.informix.jdbc.IfxSqli.a(IfxSqli.java:3204)
      at com.informix.jdbc.IfxSqli.E(IfxSqli.java:3518)
      at com.informix.jdbc.IfxSqli.dispatchMsg(IfxSqli.java:2353)
      at com.informix.jdbc.IfxSqli.receiveMessage(IfxSqli.java:2269)
      at com.informix.jdbc.IfxSqli.executePrepare(IfxSqli.java:1153)
      at com.informix.jdbc.IfxPreparedStatement.e(IfxPreparedStatement.java:318)
      at com.informix.jdbc.IfxPreparedStatement.a(IfxPreparedStatement.java:298)
      at com.informix.jdbc.IfxPreparedStatement.<init>(IfxPreparedStatement.java:205)
      at com.informix.jdbc.IfxSqliConnect.prepareStatement(IfxSqliConnect.java:2023)
      at org.apache.commons.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:458)
      at com.isomorphic.sql.InformixDriver.getPreparedStatement(InformixDriver.java:249)
      at com.isomorphic.sql.SQLDriver.doUpdate(SQLDriver.java:732)
      at com.isomorphic.sql.SQLDriver.update(SQLDriver.java:700)
      at com.isomorphic.sql.SQLDriver.executeUpdate(SQLDriver.java:824)
      at com.isomorphic.sql.SQLDataSource.executeNativeUpdate(SQLDataSource.java:419)
      at com.isomorphic.sql.SQLDataSource.SQLExecute(SQLDataSource.java:1464)
      at com.isomorphic.sql.SQLDataSource.processRequest(SQLDataSource.java:306)
      at com.isomorphic.sql.SQLDataSource.executeAdd(SQLDataSource.java:258)
      at com.isomorphic.datasource.DataSource.execute(DataSource.java:1370)
      at com.isomorphic.application.AppBase.executeDefaultDSOperation(AppBase.java:726)
      at com.isomorphic.application.AppBase.executeAppOperation(AppBase.java:658)
      at com.isomorphic.application.AppBase.execute(AppBase.java:491)
      at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:2031)
      at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:216)
      at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:173)
      at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:138)
      at com.isomorphic.servlet.IDACall.doPost(IDACall.java:74)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
      at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1097)
      at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:259)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
      at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
      at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
      at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
      at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
      at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
      at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      at org.mortbay.jetty.Server.handle(Server.java:324)
      at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
      at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
      at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
      at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205)
      at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
      at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
      at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
      Caused by: java.sql.SQLException: ISAM error: no record found.
      at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:373)
      at com.informix.jdbc.IfxSqli.E(IfxSqli.java:3523)
      ... 48 more
      === 2013-02-22 14:53:34,860 [l0-0] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
      === 2013-02-22 14:53:34,860 [l0-0] DEBUG SQLTransaction - Rolling back Informix transaction "51801608"
      === 2013-02-22 14:53:34,862 [l0-0] DEBUG RPCManager - non-DMI response, dropExtraFields: false
      === 2013-02-22 14:53:34,863 [l0-0] DEBUG SQLTransaction - Returning transactional connection for Informix with hashcode "51801608"
      === 2013-02-22 14:53:34,863 [l0-0] DEBUG SQLTransaction - Ending Informix transaction "51801608"
      === 2013-02-22 14:53:34,863 [l0-0] DEBUG SQLConnectionManager - About to close PoolableConnection with hashcode "51801608"
      === 2013-02-22 14:53:34,863 [l0-0] INFO Compression - /triad40/sc/IDACall: 190 -> 162 bytes
      === 2013-02-22 14:53:35,020 [l0-0] INFO RequestContext - URL: '/triad40/sc/skins/Graphite/images/Dialog/warn.png', User-Agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; KB974488)': MSIE with Accept-Encoding header, ready for compressed JS
      === 2013-02-22 14:53:35,121 [l0-0] INFO RequestContext - URL: '/triad40/sc/skins/Graphite/images/headerIcons/close.png', User-Agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; KB974488)': MSIE with Accept-Encoding header, ready for compressed JS
      === 2013-02-22 14:53:35,150 [l0-3] INFO RequestContext - URL: '/triad40/sc/skins/Graphite/images/Window/window_TR.png', User-Agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; KB974488)': MSIE with Accept-Encoding header, ready for compressed JS
      === 2013-02-22 14:53:35,150 [l0-0] INFO RequestContext - URL: '/triad40/sc/skins/Graphite/images/Window/window_TL.png', User-Agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; KB974488)': MSIE with Accept-Encoding header, ready for compressed JS
      === 2013-02-22 14:53:35,152 [l0-2] INFO RequestContext - URL: '/triad40/sc/skins/Graphite/images/Window/window_R.png', User-Agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; KB974488)': MSIE with Accept-Encoding header, ready for compressed JS
      === 2013-02-22 14:53:35,152 [l0-4] INFO RequestContext - URL: '/triad40/sc/skins/Graphite/images/Window/window_T.png', User-Agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; KB974488)': MSIE with Accept-Encoding header, ready for compressed JS
      === 2013-02-22 14:53:35,153 [l0-7] INFO RequestContext - URL: '/triad40/sc/skins/Graphite/images/Window/window_L.png', User-Agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; KB974488)': MSIE with Accept-Encoding header, ready for compressed JS
      === 2013-02-22 14:53:35,158 [l0-6] INFO RequestContext - URL: '/triad40/sc/skins/Graphite/images/Window/window_BL.png', User-Agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; KB974488)': MSIE with Accept-Encoding header, ready for compressed JS
      === 2013-02-22 14:53:35,159 [l0-2] INFO RequestContext - URL: '/triad40/sc/skins/Graphite/images/Window/window_B.png', User-Agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; KB974488)': MSIE with Accept-Encoding header, ready for compressed JS
      === 2013-02-22 14:53:35,159 [l0-3] INFO RequestContext - URL: '/triad40/sc/skins/Graphite/images/Window/window_BR.png', User-Agent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; KB974488)': MSIE with Accept-Encoding header, ready for compressed JS


      Hope this will gave you the idea. Please let me know if you need more information.

      Comment


        #4
        It looks like you've got some code, possibly in a DMI, doing this:

        Code:
        === 2013-02-22 14:53:34,805 [l0-0] INFO  SQLDriver - [builtinApplication.add2] Executing SQL update on 'Informix': SELECT services.service_nbr FROM services
                                                        INTO TEMP services_temp;
        However you're executing this, it's not in the scope of the current transaction. This sample shows the correct approach.

        Comment

        Working...
        X