Result Set is getting close in 12 Min
Hi,
I am facing one issue here with the JDBC.
I am doing a query to the oracle db , where I have more the 80K records in our one of table. Once I recieved the data in resultset. I am iterating them in batch of length 1024 from the result set. But I am able to do only 5 Iteration and result set getting connection closed SQLException in 12 Min. Here is the stack trace.
Caused by: java.sql.SQLException: Closed Connection: next
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.OracleResultSetImpl.next(OracleResultSetImpl.java:181)-
I have seen that result set has all the records.
Can you please help me here is that any time can mentioned in resultSet.
Thanks,
Mukesh
Hi,
After run some more test execution and adding the connection.isClosed() in the traces I have seen that below mentioned exception.
Caused by: java.sql.SQLException: Operation invoked on a bad Jdbc connection please check database connectivity
at com.inprise.visitransact.jdbc2.ConnectionProxy.checkConnectionTimeout(ConnectionProxy.java:1136)
at com.inprise.visitransact.jdbc2.ConnectionProxy.isClosed(ConnectionProxy.java:891)
at com.lucent.iems.platform.fm.dataaccess.AbstractBaseQuery.getData(AbstractBaseQuery.java:144)
... 30 more
I have seen the connection was not closed till 10 min 19 sec. I have printed in logs also.
2010/05/14 10:16:11;conn is valid before:false
2010/05/14 10:21:25;conn is valid before:false
2010/05/14 10:24:15;conn is valid before:false
2010/05/14 10:26:30;conn is valid before:false
Is it possible that connection get bad in this time period. This exception I saw in Borland Application server API
private void checkConnectionTimeout()
throws SQLException
if(_holder != null)
if(_holder.getState() == Jdbc2ConnState.BusyTimedOut)
throw new SQLException("A JDBC connection can't be used beyond transaction timeout or busyTimeout");
if(_holder.getState() == Jdbc2ConnState.Discarded)
throw new SQLException("Operation invoked on a bad Jdbc connection please check database connectivity");
But not sure why this connection is discarded.
Similar Messages
-
Getting Result set close error while updating row
Hi,
Working on jdev 11.1.1.3.0, ADF BC with rich faces.
I am updating on the selected rows, the selected rows are updating but here my problem after updating the rows when i scroll down the table then i am getting error like Result Set is already close, can any one help me how to resolve this.
Java Code:
RowKeySet rowKeySet = (RowKeySet)this.embossTB.getSelectedRowKeys();
CollectionModel cm = (CollectionModel)this.embossTB.getValue();
for (Object facesTreeRowKey : rowKeySet) {
cm.setRowKey(facesTreeRowKey);
JUCtrlHierNodeBinding rowData = (JUCtrlHierNodeBinding)cm.getRowData();
oracle.jbo.domain.Date dt =
new oracle.jbo.domain.Date(new java.sql.Timestamp(System.currentTimeMillis()));
rowData.setAttribute("EmbossingState", "PRINTED");
rowData.setAttribute("EmbossingDate", dt);
embossIter.getViewObject().getApplicationModule().getTransaction().commit();
AdfFacesContext.getCurrentInstance().addPartialTarget(embossTB);
Error:
oracle.jbo.AttributeLoadException: JBO-27022: Failed to load value at index 1 with java object of type java.lang.String due to java.sql.SQLException.
at oracle.jbo.server.AttributeDefImpl.loadFromResultSet(AttributeDefImpl.java:2327)
at oracle.jbo.server.ViewRowImpl.populate(ViewRowImpl.java:3622)
at oracle.jbo.server.ViewDefImpl.createInstanceFromResultSet(ViewDefImpl.java:2203)
at oracle.jbo.server.ViewObjectImpl.createRowFromResultSet(ViewObjectImpl.java:5325)
at oracle.jbo.server.ViewObjectImpl.createInstanceFromResultSet(ViewObjectImpl.java:5174)
at oracle.jbo.server.QueryCollection.populateRow(QueryCollection.java:3304)
at oracle.jbo.server.QueryCollection.fetch(QueryCollection.java:3164)
at oracle.jbo.server.QueryCollection.get(QueryCollection.java:2154)
at oracle.jbo.server.ViewRowSetImpl.getRow(ViewRowSetImpl.java:4853)
at oracle.jbo.server.ViewRowSetIteratorImpl.scrollRange(ViewRowSetIteratorImpl.java:1350)
at oracle.jbo.server.ViewRowSetIteratorImpl.setRangeStartWithRefresh(ViewRowSetIteratorImpl.java:2708)
at oracle.jbo.server.ViewRowSetIteratorImpl.setRangeStart(ViewRowSetIteratorImpl.java:2693)
at oracle.jbo.server.ViewRowSetImpl.setRangeStart(ViewRowSetImpl.java:2895)
at oracle.jbo.server.ViewObjectImpl.setRangeStart(ViewObjectImpl.java:9457)
at oracle.adf.model.binding.DCIteratorBinding.setRangeStart(DCIteratorBinding.java:3378)
at oracle.adfinternal.view.faces.model.binding.RowDataManager._bringInToRange(RowDataManager.java:105)
at oracle.adfinternal.view.faces.model.binding.RowDataManager.setRowIndex(RowDataManager.java:63)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding$FacesModel.setRowIndex(FacesCtrlHierBinding.java:603)
at org.apache.myfaces.trinidad.component.UIXCollection.setRowIndex(UIXCollection.java:442)
at oracle.adfinternal.view.faces.renderkit.rich.TableRenderer.renderDataBlockRows(TableRenderer.java:1837)
at oracle.adfinternal.view.faces.renderkit.rich.TableRenderer._renderSingleDataBlock(TableRenderer.java:1601)
at oracle.adfinternal.view.faces.renderkit.rich.TableRenderer._handleDataFetch(TableRenderer.java:968)
at oracle.adfinternal.view.faces.renderkit.rich.TableRenderer.encodeAll(TableRenderer.java:504)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1369)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:765)
at org.apache.myfaces.trinidad.component.UIXCollection.encodeEnd(UIXCollection.java:529)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:415)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2567)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:432)
at oracle.adfinternal.view.faces.renderkit.rich.PanelBoxRenderer._encodeAllChildren(PanelBoxRenderer.java:1330)
at oracle.adfinternal.view.faces.renderkit.rich.PanelBoxRenderer._renderContentRow(PanelBoxRenderer.java:1255)
at oracle.adfinternal.view.faces.renderkit.rich.PanelBoxRenderer.encodeAll(PanelBoxRenderer.java:339)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1369)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:765)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:415)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2567)
at oracle.adfinternal.view.faces.renderkit.rich.ShowDetailItemRenderer.access$100(ShowDetailItemRenderer.java:31)
at oracle.adfinternal.view.faces.renderkit.rich.ShowDetailItemRenderer$ChildEncoderCallback.processComponent(ShowDetailItemRenderer.java:492)
at oracle.adfinternal.view.faces.renderkit.rich.ShowDetailItemRenderer$ChildEncoderCallback.processComponent(ShowDetailItemRenderer.java:465)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:170)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:290)
at org.apache.myfaces.trinidad.component.UIXComponent.encodeFlattenedChildren(UIXComponent.java:255)
at oracle.adfinternal.view.faces.renderkit.rich.ShowDetailItemRenderer._encodeChildren(ShowDetailItemRenderer.java:407)
at oracle.adfinternal.view.faces.renderkit.rich.ShowDetailItemRenderer.encodeAll(ShowDetailItemRenderer.java:114)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1369)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:765)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:415)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2567)
at oracle.adf.view.rich.render.RichRenderer.encodeStretchedChild(RichRenderer.java:1963)
at oracle.adfinternal.view.faces.renderkit.rich.PanelTabbedRenderer.access$500(PanelTabbedRenderer.java:39)
at oracle.adfinternal.view.faces.renderkit.rich.PanelTabbedRenderer$BodyEncoderCallback.processComponent(PanelTabbedRenderer.java:1059)
at oracle.adfinternal.view.faces.renderkit.rich.PanelTabbedRenderer$BodyEncoderCallback.processComponent(PanelTabbedRenderer.java:1010)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:170)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:290)
at org.apache.myfaces.trinidad.component.UIXComponent.encodeFlattenedChildren(UIXComponent.java:255)
at oracle.adfinternal.view.faces.renderkit.rich.PanelTabbedRenderer._renderTabBody(PanelTabbedRenderer.java:606)
at oracle.adfinternal.view.faces.renderkit.rich.PanelTabbedRenderer.encodeAll(PanelTabbedRenderer.java:262)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1369)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:765)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:415)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2567)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer._encodeChild(PanelGroupLayoutRenderer.java:405)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer.access$300(PanelGroupLayoutRenderer.java:30)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer$EncoderCallback.processComponent(PanelGroupLayoutRenderer.java:654)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer$EncoderCallback.processComponent(PanelGroupLayoutRenderer.java:573)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:170)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:290)
at org.apache.myfaces.trinidad.component.UIXComponent.encodeFlattenedChildren(UIXComponent.java:255)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer.encodeAll(PanelGroupLayoutRenderer.java:330)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1369)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:765)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:415)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2567)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:432)
at oracle.adfinternal.view.faces.renderkit.rich.RegionRenderer.encodeAll(RegionRenderer.java:176)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1369)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:765)
at oracle.adf.view.rich.component.fragment.UIXRegion.encodeEnd(UIXRegion.java:289)
at org.apache.myfaces.trinidad.component.UIXComponentBase.__encodeRecursive(UIXComponentBase.java:1515)
at org.apache.myfaces.trinidad.component.UIXGroup.encodeChildren(UIXGroup.java:138)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:402)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2567)
at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer.encodeCenterFacet(PanelStretchLayoutRenderer.java:297)
at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer._encodeCenterPane(PanelStretchLayoutRenderer.java:574)
at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer.encodeAll(PanelStretchLayoutRenderer.java:241)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1369)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:765)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:415)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2567)
at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer.encodeCenterFacet(PanelStretchLayoutRenderer.java:297)
at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer._encodeCenterPane(PanelStretchLayoutRenderer.java:574)
at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer.encodeAll(PanelStretchLayoutRenderer.java:241)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1369)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:765)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:415)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2567)
at oracle.adf.view.rich.render.RichRenderer.encodeStretchedChild(RichRenderer.java:1963)
at oracle.adfinternal.view.faces.renderkit.rich.PanelSplitterRenderer._renderPane(PanelSplitterRenderer.java:1044)
at oracle.adfinternal.view.faces.renderkit.rich.PanelSplitterRenderer._renderSecondPane(PanelSplitterRenderer.java:943)
at oracle.adfinternal.view.faces.renderkit.rich.PanelSplitterRenderer.encodeAll(PanelSplitterRenderer.java:197)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1369)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:765)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:415)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2567)
at oracle.adfinternal.view.faces.renderkit.rich.DecorativeBoxRenderer.encodeFacet(DecorativeBoxRenderer.java:289)
at oracle.adfinternal.view.faces.renderkit.rich.DecorativeBoxRenderer._encodeCenterPane(DecorativeBoxRenderer.java:442)
at oracle.adfinternal.view.faces.renderkit.rich.DecorativeBoxRenderer.encodeAll(DecorativeBoxRenderer.java:258)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1369)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:765)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:415)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2567)
at oracle.adf.view.rich.render.RichRenderer.encodeStretchedChild(RichRenderer.java:1963)
at oracle.adfinternal.view.faces.renderkit.rich.PanelSplitterRenderer._renderPane(PanelSplitterRenderer.java:1044)
at oracle.adfinternal.view.faces.renderkit.rich.PanelSplitterRenderer._renderSecondPane(PanelSplitterRenderer.java:943)
at oracle.adfinternal.view.faces.renderkit.rich.PanelSplitterRenderer.encodeAll(PanelSplitterRenderer.java:197)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1369)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:765)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:415)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2567)
at oracle.adfinternal.view.faces.renderkit.rich.DecorativeBoxRenderer.encodeFacet(DecorativeBoxRenderer.java:289)
at oracle.adfinternal.view.faces.renderkit.rich.DecorativeBoxRenderer._encodeCenterPane(DecorativeBoxRenderer.java:442)
at oracle.adfinternal.view.faces.renderkit.rich.DecorativeBoxRenderer.encodeAll(DecorativeBoxRenderer.java:258)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1369)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:765)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:415)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2567)
at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer.encodeCenterFacet(PanelStretchLayoutRenderer.java:297)
at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer._encodeCenterPane(PanelStretchLayoutRenderer.java:574)
at oracle.adfinternal.view.faces.renderkit.rich.PanelStretchLayoutRenderer.encodeAll(PanelStretchLayoutRenderer.java:241)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1369)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:765)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:415)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2567)
at oracle.adf.view.rich.render.RichRenderer.encodeStretchedChild(RichRenderer.java:1963)
at oracle.adfinternal.view.faces.renderkit.rich.PanelSplitterRenderer._renderPane(PanelSplitterRenderer.java:1044)
at oracle.adfinternal.view.faces.renderkit.rich.PanelSplitterRenderer._renderSecondPane(PanelSplitterRenderer.java:943)
at oracle.adfinternal.view.faces.renderkit.rich.PanelSplitterRenderer.encodeAll(PanelSplitterRenderer.java:197)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1369)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:765)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:415)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2567)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:432)
at oracle.adfinternal.view.faces.renderkit.rich.PageTemplateRenderer.encodeAll(PageTemplateRenderer.java:69)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1369)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:765)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.encodeEnd(ContextSwitchingComponent.java:153)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:415)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2567)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:432)
at oracle.adfinternal.view.faces.renderkit.rich.FormRenderer.encodeAll(FormRenderer.java:220)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1369)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:765)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:415)
at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2567)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:432)
at oracle.adfinternal.view.faces.renderkit.rich.DocumentRenderer.encodeAll(DocumentRenderer.java:1071)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1369)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:765)
at org.apache.myfaces.trinidad.component.UIXComponentBase.__encodeRecursive(UIXComponentBase.java:1515)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeAll(UIXComponentBase.java:785)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:942)
at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:271)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:202)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:189)
at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:193)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._renderResponse(LifecycleImpl.java:710)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:273)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:205)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:191)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:97)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:94)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:414)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:138)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:159)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:330)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3684)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused by: java.sql.SQLException: Result set already closed
at weblogic.jdbc.wrapper.ResultSet.checkResultSet(ResultSet.java:110)
at weblogic.jdbc.wrapper.ResultSet.preInvocationHandler(ResultSet.java:65)
at weblogic.jdbc.wrapper.ResultSet_oracle_jdbc_driver_OracleResultSetImpl.getString(Unknown Source)
at oracle.jbo.common.StringTypeSQLNativeImpl.getDataFromResultSet(JboTypeMapEntries.java:480)
at oracle.jbo.server.AttributeDefImpl.loadFromResultSet(AttributeDefImpl.java:2318)
... 222 more
Edited by: user5802014 on Aug 12, 2010 10:48 AMYou are calling commit on every row inside your for loop. I would avoid this because it's time consuming.
Next thing I noticed is that you call the commit directly on the application module bypassing all binding layer stuff.
Try putting the commit operation into the bindings and call it there. This will give the framework the chance to do its stuff.
If this does not help you can re execute the query of the VO in question after updating the selected rows.
Timo -
JDBC-ODBC Bridge to SPSS data files - Result Set Type is not supported
Hello,
As mentioned in the subject I am trying to read SPSS data files using the SPSS 32-Bit data driver, ODBC and the JDBC-ODBC Bridge.
Using this SPSS Driver I manged to read the data directly into an MS-SQL Server using:
SELECT [...] FROM
OPENROWSET(''MSDASQL.1'',''DRIVER={SPSS 32-BIT Data Driver (*.sav)};DBQ=' SomePathWhereTheFilesAre';SERVER=NotTheServer'', ''SELECT 'SomeSPSSColumn' FROM "'SomeSPSSFileNameWithoutExt'"'') AS a
This works fine!
Using Access and an ODBC System DNS works for IMPORTING but NOT for LINKING.
It is even possible to read the data using the very slow SPSS API.
However, when it comes to JDBC-ODBC the below code does only work in part. The driver is loaded successfully, but when it comes to transferring data into the resultset object the error
SQLState: null
Result Set Type is not supported
Vendor: 0
occurs.
The official answer from SPSS is to use .Net or to use their implementation with Python in their new version 14.0. But this is obviously not an option when you want to use only Java.
Does anybody have experience with SPSS and JDBC-ODBC??? I have tried the possible ResultSet Types, which I took from:
http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/ad/rjvdsprp.htm
and none of them worked.
Thank you in advance for your ideas and input & stay happy!
Here the code without all the rest of the class arround it:
// Module: SimpleSelect.java
// Description: Test program for ODBC API interface. This java application
// will connect to a JDBC driver, issue a select statement
// and display all result columns and rows
// Product: JDBC to ODBC Bridge
// Author: Karl Moss
// Date: February, 1996
// Copyright: 1990-1996 INTERSOLV, Inc.
// This software contains confidential and proprietary
// information of INTERSOLV, Inc.
public static void main1() {
String url = "jdbc:odbc:SomeSystemDNS";
String query = "SELECT SomeSPSSColumn FROM 'SomeSPSSFileName'";
try {
// Load the jdbc-odbc bridge driver
Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
DriverManager.setLogStream(System.out);
// Attempt to connect to a driver. Each one
// of the registered drivers will be loaded until
// one is found that can process this URL
Connection con = DriverManager.getConnection (url);
// If we were unable to connect, an exception
// would have been thrown. So, if we get here,
// we are successfully connected to the URL
// Check for, and display and warnings generated
// by the connect.
checkForWarning (con.getWarnings ());
// Get the DatabaseMetaData object and display
// some information about the connection
DatabaseMetaData dma = con.getMetaData ();
System.out.println("\nConnected to " + dma.getURL());
System.out.println("Driver " +
dma.getDriverName());
System.out.println("Version " +
dma.getDriverVersion());
System.out.println("");
// Create a Statement object so we can submit
// SQL statements to the driver
Statement stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY ,ResultSet.CONCUR_READ_ONLY);
// Submit a query, creating a ResultSet object
ResultSet rs = stmt.executeQuery (query);
// Display all columns and rows from the result set
dispResultSet (rs);
// Close the result set
rs.close();
// Close the statement
stmt.close();
// Close the connection
con.close();
}Thank you for your reply StuDerby!
Actually the above script was before, as you suggested, leaving the ResultSetTeype default. This did not work...
I am getting gray hair with SPSS - in terms of connectivity and "integratebility" none of their solutions offered is sufficient from my point of view.
Variable definitions can only be read by the slow API, data can only be read by Python or Microsoft Products... and if you want to combine both you are in big trouble. I can only assume that this is a company strategy to sell their Dimensions Platform to companies versus having companies developping their applications according to business needs.
Thanks again for any furthur suggestions and I hope, that some SPSS Developper will see this post!
Cheers!! -
Returning a result set/record from a dynamic query
There seems to be plenty of examples for using Native Dynamic Sql to formulate and execute a dynamic query, however there are no examples of returning a result set or records which contain the rows of data that are retrieved by executing the query. Could someone give us an example?
Welcome to the Oracle forum....
CREATE OR REPLACE PACKAGE curspkg_join AS
TYPE t_cursor IS REF CURSOR ;
Procedure open_join_cursor1 (n_EMPNO IN NUMBER, io_cursor IN OUT t_cursor);
END curspkg_join;
Create the following Oracle package body on the Oracle server:
CREATE OR REPLACE PACKAGE BODY curspkg_join AS
Procedure open_join_cursor1 (n_EMPNO IN NUMBER, io_cursor IN OUT t_cursor)
IS
v_cursor t_cursor;
BEGIN
IF n_EMPNO <> 0
THEN
OPEN v_cursor FOR
SELECT EMP.EMPNO, EMP.ENAME, DEPT.DEPTNO, DEPT.DNAME
FROM EMP, DEPT
WHERE EMP.DEPTNO = DEPT.DEPTNO
AND EMP.EMPNO = n_EMPNO;
ELSE
OPEN v_cursor FOR
SELECT EMP.EMPNO, EMP.ENAME, DEPT.DEPTNO, DEPT.DNAME
FROM EMP, DEPT
WHERE EMP.DEPTNO = DEPT.DEPTNO;
END IF;
io_cursor := v_cursor;
END open_join_cursor1;
END curspkg_join;
Dim Oraclecon As New OracleConnection("Password=pwd;" & _
"User ID=uid;Data Source=MyOracle;")
Oraclecon.Open()
Dim myCMD As New OracleCommand()
myCMD.Connection = Oraclecon
myCMD.CommandText = "curspkg_join.open_join_cursor1"
myCMD.CommandType = CommandType.StoredProcedure
myCMD.Parameters.Add(New OracleParameter("io_cursor", OracleType.Cursor)).Direction = ParameterDirection.Output
myCMD.Parameters.Add("n_Empno", OracleType.Number, 4).Value = 123
Dim myReader As OracleDataReader
Try
myCMD.ExecuteNonQuery()
Catch myex As Exception
MsgBox(myex.Message)
End Try
myReader = myCMD.Parameters("io_cursor").Value
Dim x, count As Integer
count = 0
Do While myReader.Read()
For x = 0 To myReader.FieldCount - 1
Console.Write(myReader(x) & " ")
Next
Console.WriteLine()
count += 1
Loop
MsgBox(count & " Rows Returned.")
myReader.Close()
Oraclecon.Close()
The above code is working in one of our application; which is using ref cursor as result set and get from procedure. I hope you can found more code by google and/or search in this forum as well; if above code is not useful to you.
HTH
Girish Sharma -
Problem in Retrive values from result set
I have a class where i do all database operation .First i fire select query and take values from result set and based on that value i fire update query.
Problem is that i am not getting all values from result set . i get only last value and when i fire update query i get error as :Resultset is closed.
I am using acess and java.You probably are using the same Statement object for both queries? Try creating separate Statement objects for each query. (My guess is this a problem with the way you're using JDBC, not a Servlet issue.)
-
Convert result set into input stream
Hi,
I have result set with me having 93 columns with 1 lac rows. I want to download the result set as xls file.
Because of the data set size is large, i'm not able to hold the data in java object. So i'm trying to convert result set to input stream and giving this input stream to servlet output stream by specifying the contentType as text/xls.
I'm not able to convert result set into input stream.
Could you provide a solution here...
Thanks,
Rajesh1 - JDBC is the wrong way to extract this data. It's like "What's the fastest way
to copy the Oxford English Dictionary using tweets?" I would research the
DBMS's bulk extract functionality.
2 - Are you dead-set absolutely sure you need to do this at all? What can you
do with the data all in one flat file that you cannot do with SQL access to the
data?
3 - If you want to convert all the columns into one (not that it's a huge
win or anything), you can use the DBMS's conversion and concatenation
functionality in your SQL. So instead of
"select col1, col2, col3, .... from MyBigTable"
do (change this to whatever conversion function syntax and concat syntax your DBMS needs)
"select convert(col1, varchar) concat ' ' concat convert(col2, varchar) concat ' ' concat convert(col3, varchar) ... from MyBigTable"
so the result set you get is a single column.
Joe -
Error when creating a saved result set
Hi all,
I want to create a saved result set with the marketing tool in OBIEE. I have made a saved result list format. But when I want to create the saved result set, I get this error:
Error in getting cursor for WorkNode (Id:0)
Authentication Failure.
Odbc driver returned an error (SQLDriverConnectW).
State: 08004. Code: 10018. [NQODBC] [SQL_STATE: 08004] [nQSError: 10018] Access for the requested connection is refused. [nQSError: 43001] Authentication failed for Administrator in repository Star: invalid user/password. (08004)
Does anyone know how to solve this?Hi,
You would have to create Credential store values for the Administrator User.
(Refere to the Chapter 5 – “Oracle BI Presentation Services Credential Store” of the OBIEE Deployment Guide). You would have to include the Credential store info and additional Administrator user tag to overcome this issue.
Hope this helps!
Thanks
Yuvaraj Narayanan -
The result set I get for a search now only shows the company name and address, if I want the telephone number of the company in the result set, I have to click on the link to go the site information to get the number. I want the company name, address and phone number to show up in the result set without having to click on each hyperlink to get the telephone number...
???
See my profile at the left for information you are missing.
Who, when, why, how, how much, what is the URL -
How to get the number of columns in a result set???
hi everyone..
i am trying to establish a servlet applet communication....
my applet send the sql query to the servlet as serialised string and then the servlet executes the query...
Since i need to pass the result back to the applet, i thaught of passing the whole reult set to the applet..but that seems to be not possible..
so i thaught of storing my result set data in a vector and then pass the vector,but the first problem that i came across is that how to get the number of colums in a result set....
so is there a way to get the number of columns in a result set...???
and also i would like to know if it possible to send my whole result set to the applet bye serialization or by any method...???
thanx in advanceYou shouldn't do. It expenses resources (you should always close the ResultSet and the Statement as fast as possible). Simply gently process it into a Collection or Map of DTO's. Those are serializable.
-
Getting Error message"Result set already closed"
i am getting java.lang.reflect.InvocationTargetException when i write code as
rs.clearWarnings();
rs.close();
rs = null;
but i am not getting any exception when write as
rs.close();
rs = null;
java.lang.reflect.InvocationTargetException
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:597)
at org.rbi.aas.util.BusinessDelegateBean.service(BusinessDelegateBean.java:119)
at org.rbi.aas.util.BusinessDelegate_mpm9t2_EOImpl.__WL_invoke(Unknown Source)
at weblogic.ejb.container.internal.SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:40)
at org.rbi.aas.util.BusinessDelegate_mpm9t2_EOImpl.service(Unknown Source)
at org.rbi.aas.util.BusinessDelegate_mpm9t2_EOImpl_CBV.service(Unknown Source)
at org.rbi.aas.util.CommonWebUtil.processRequest(CommonWebUtil.java:48)
at org.rbi.aas.trans.actionclass.BankMergerAction.execute(BankMergerAction.java:149)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: java.sql.SQLException: Result set already closed
at weblogic.jdbc.wrapper.ResultSet.checkResultSet(ResultSet.java:144)
at weblogic.jdbc.wrapper.ResultSet.preInvocationHandler(ResultSet.java:97)
at weblogic.jdbc.wrapper.ResultSet_oracle_jdbc_driver_OracleResultSetImpl.clearWarnings(Unknown Source)
at org.rbi.aas.util.DAOManagerImpl.resetResultSet(DAOManagerImpl.java:72)
at org.rbi.aas.trans.dao.BankMergerDAO.getMerger(BankMergerDAO.java:95)
at org.rbi.aas.trans.model.BankMergerFacadeBean.service(BankMergerFacadeBean.java:73)
at org.rbi.aas.trans.model.BankMergerFacade_2lp38w_ELOImpl.__WL_invoke(Unknown Source)
at weblogic.ejb.container.internal.SessionLocalMethodInvoker.invoke(SessionLocalMethodInvoker.java:39)
at org.rbi.aas.trans.model.BankMergerFacade_2lp38w_ELOImpl.service(Unknown Source)
... 41 more
[17.07.2013 16:07:00]-[INFO]-[[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)']-[BusinessDelegateBean]-[[TRC] - service - BusinessDelegateBean:service: Reached at InvocationTargetException class java.sql.SQLException]
BusinessException Caught
java.lang.Exception: Result set already closed
at org.rbi.aas.util.BusinessDelegateBean.service(BusinessDelegateBean.java:137)
at org.rbi.aas.util.BusinessDelegate_mpm9t2_EOImpl.__WL_invoke(Unknown Source)
at weblogic.ejb.container.internal.SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:40)
at org.rbi.aas.util.BusinessDelegate_mpm9t2_EOImpl.service(Unknown Source)
at org.rbi.aas.util.BusinessDelegate_mpm9t2_EOImpl_CBV.service(Unknown Source)
at org.rbi.aas.util.CommonWebUtil.processRequest(CommonWebUtil.java:48)
at org.rbi.aas.trans.actionclass.BankMergerAction.execute(BankMergerAction.java:149)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)rs.clearWarnings();
rs.close();
rs = null;
above code works perfectly well in jdeveoper 10g .....i am facing problem in JDeveloper 11.1.2.4.0...recently we have migrated to new weblogic server -
How to get the number of records of a streaming result set
Hi guys.
So if it wasn't a streaming result set, I would have done this:
{noformat}myResultSet<code class="jive-code jive-java">.last();
{color:navy}*int*{color} numResults = </code>myResultSet<code class="jive-code jive-java">.getRow();
</code>myResultSet<code class="jive-code jive-java">.beforeFirst();
</code>{noformat}
but being a streaming result set, beforeFirst() throws an exception...
So how do you get the number of records in that result set? I wanna avoid an extra count(*) query, so I would appreciate other solutions than that.JoachimSauer wrote:
vanwil wrote:
you see, for now I just use a count(*) query to get the number of records, but that's adding a lot of extra waiting time...Iterating over the result twice will surely be slower then doing the count(*).great! so what I got now is actually the fastest way there is... awesome...
If you get an exception, then you surely have a stack trace. That should tell you what happens, or at least where.com.mysql.jdbc.MysqlIO.checkForOutstandingStreamingData(MysqlIO.java:2066)
Why do you need to know the number of elements beforehand, anyway?I need to know the number of elements because the incoming data goes into a table. Now of course, I could use ArrayList<String[]> or something, but wouldn't that require more memory resources than Object[][] ?
No one can tell you that, at least not without more information (say, the stack trace for example).Here's the exception message:
java.sql.SQLException: Streaming result set com.mysql.jdbc.RowDataDynamic@10c0ef2 is still active. Only one streaming result set may be open and in use per-connection. Ensure that you have called .close() on any active result sets before attempting more queries. -
Which is more efficient way to get result set from database server
Hi,
I am working on a project where I require to query database to fetch result set and then iterate through the resultset. Now, What I want is that I want to create one single java code that would call many different SQLs and create a list out of resultset. There are two approaches for me.
1.) To create a txt file where I can store my queries. My java program can read this file and get the appropriate query to be used.
2.) To create a stored procedure containing the queries and call the stored procedure from my java program. Also, not that some of the queries needs to be created dynamically depending upon the parameteters supplied.
Out of these two approches which is optimum and why?
Also, following things to be noted.
1. At times I want to create where clause of the query dynamically depenending upon the parameters passed.
2. I want one single java file that will handle all database calls.
3. Paramters to the stored procedure can be passed using array descriptor.
4. Conneciton I am making using JNDI.
Please do provide me optimum way of out these two. You may also suggest some other approaches, if any.
Thanks,
Rajan
Edited by: RP on Jun 26, 2012 11:11 PMRP wrote:
In case of queries stored in text files. I will require to replace some pre defined placeholder with actual parameters and then pass that modified query to db engine. Even I liked the second approach as it is more easily maintainable. There are a couple of issues. Shared SQL is one. Irrespective of the method used, the SQL cursor that is created needs to have bind variables. This ensures re-usability of the cursor. This reduces the risk of Shared Pool fragmentation. This lowers hard parsing and reduces CPU utilisation.
Another issue is flexibility. If the SQL cursors are created by stored procedures, this code resides on the server and abstracts the Java client from the complexities of SQL and SQL performance. The code can easily be updated and fine tuned to deliver faster/better SQL cursors, or modified to take new Oracle features, changes in data model, and so on, into consideration. This stored proc can be updated without having to touch or recompile a single byte of Java client code.
There's also the security issue. What is more secure? SQL encapsulated in stored procs in a secure database and server environment? Or SQL "encapsulated" in text files on the client?
The less code you have running on the client, the less code you have running in the wild that can be compromised without having to first compromise the server.
Only I was worried about any performace issue might happen using this approach. Performance is not a factor of who creates the SQL cursor.
Whether Java client creates a SQL cursor, or a PL/SQL stored proc creates a SQL cursor, or a .Net client creates a SQL cursor - that SQL cursor does not know what the client is. It does not care what the client is. The SQL cursor performs as well as it is capable of.. given the execution plan, data volumes, server resources and speed/performance of the server.
The client language and SQL cursor interface used by the client (there are several in PL/SQL), determines the performance of the client's interaction with the cursor (e.g. round trips to the database when interfacing with the cursor). The client language (and its client interface to the cursor) does not dictate the actual performance of that SQL cursor on the database (does not make joins faster, or I/O faster)
One more question, Will my java program close the cursor that I opened in Procedure?That you need to ask your Java code. Java code leaking ref cursors are unfortunately all too common. You need to make sure that your Java client interface to SQL cursors, closes the cursor handle when done. -
Why to need close the result set and statement
why to need close the result set and statement
It's best to explicitly close every ResultSet, Statement, and Connection in the narrowest scope possible.
These should be closed in a finally block.
Since each close() method throws SQLException, each one should be in an individual try/catch block to ensure that a failure to close one won't ruin the chances for all the others.
You can capture this in one nice utility class, like this:
package db;
import java.sql.*;
import java.util.ArrayList;
import java.util.Map;
import java.util.LinkedHashMap;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
* Created by IntelliJ IDEA.
* User: MD87020
* Date: Feb 16, 2005
* Time: 8:42:19 PM
* To change this template use File | Settings | File Templates.
public class DatabaseUtils
* Logger for DatabaseUtils
private static final Log logger = LogFactory.getLog(DatabaseUtils.class);
/** Private default ctor to prevent subclassing and instantiation */
private DatabaseUtils() {}
* Close a connection
* @param connection to close
public static void close(Connection connection)
try
if ((connection != null) && !connection.isClosed())
connection.close();
catch (SQLException e)
logger.error("Could not close connection", e);
* Close a statement
* @param statement to close
public static void close(Statement statement)
try
if (statement != null)
statement.close();
catch (SQLException e)
logger.error("Could not close statement", e);
* Close a result set
* @param rs to close
public static void close(ResultSet rs)
try
if (rs != null)
rs.close();
catch (SQLException e)
logger.error("Could not close result set", e);
* Close both a connection and statement
* @param connection to close
* @param statement to close
public static void close(Connection connection, Statement statement)
close(statement);
close(connection);
* Close a connection, statement, and result set
* @param connection to close
* @param statement to close
* @param rs to close
public static void close(Connection connection,
Statement statement,
ResultSet rs)
close(rs);
close(statement);
close(connection);
* Helper method that maps a ResultSet into a map of columns
* @param rs ResultSet
* @return map of lists, one per column, with column name as the key
* @throws SQLException if the connection fails
public static final Map toMap(ResultSet rs) throws SQLException
List wantedColumnNames = getColumnNames(rs);
return toMap(rs, wantedColumnNames);
* Helper method that maps a ResultSet into a map of column lists
* @param rs ResultSet
* @param wantedColumnNames of columns names to include in the result map
* @return map of lists, one per column, with column name as the key
* @throws SQLException if the connection fails
public static final Map toMap(ResultSet rs, List wantedColumnNames)
throws SQLException
// Set up the map of columns
int numWantedColumns = wantedColumnNames.size();
Map columns = new LinkedHashMap(numWantedColumns);
for (int i = 0; i < numWantedColumns; ++i)
List columnValues = new ArrayList();
columns.put(wantedColumnNames.get(i), columnValues);
while (rs.next())
for (int i = 0; i < numWantedColumns; ++i)
String columnName = (String)wantedColumnNames.get(i);
Object value = rs.getObject(columnName);
List columnValues = (List)columns.get(columnName);
columnValues.add(value);
columns.put(columnName, columnValues);
return columns;
* Helper method that converts a ResultSet into a list of maps, one per row
* @param rs ResultSet
* @return list of maps, one per row, with column name as the key
* @throws SQLException if the connection fails
public static final List toList(ResultSet rs) throws SQLException
List wantedColumnNames = getColumnNames(rs);
return toList(rs, wantedColumnNames);
* Helper method that maps a ResultSet into a list of maps, one per row
* @param rs ResultSet
* @param wantedColumnNames of columns names to include in the result map
* @return list of maps, one per column row, with column names as keys
* @throws SQLException if the connection fails
public static final List toList(ResultSet rs, List wantedColumnNames)
throws SQLException
List rows = new ArrayList();
int numWantedColumns = wantedColumnNames.size();
while (rs.next())
Map row = new LinkedHashMap();
for (int i = 0; i < numWantedColumns; ++i)
String columnName = (String)wantedColumnNames.get(i);
Object value = rs.getObject(columnName);
row.put(columnName, value);
rows.add(row);
return rows;
* Return all column names as a list of strings
* @param rs query result set
* @return list of column name strings
* @throws SQLException if the query fails
public static final List getColumnNames(ResultSet rs) throws SQLException
ResultSetMetaData meta = rs.getMetaData();
int numColumns = meta.getColumnCount();
List columnNames = new ArrayList(numColumns);
for (int i = 1; i <= numColumns; ++i)
columnNames.add(meta.getColumnName(i));
return columnNames;
}Anybody who lets the GC or timeouts or sheer luck handle their resource recovery for them is a hack and gets what they deserve.
Do a search on problems with Oracle cursors being exhausted and learn what the root cause is. That should convince you.
scsi-boy is 100% correct.
% -
Unexpected Result Sets by Changing MAX to MIN
I was expecting the identical result sets from the following two SQL statements:
SELECT HIST.LDR_SYSTEM_ID "MISSING SYSTEM PK"
FROM GM_SYSTEM_HIST HIST
WHERE HIST.SYSTEM_HIST_ID = (SELECT MAX (DUPL.SYSTEM_HIST_ID) /* SYSTEM_HIST_ID is the PK for GM_SYSTEM_HIST */
FROM GM_SYSTEM_HIST DUPL
WHERE HIST.LDR_SYSTEM_ID = DUPL.LDR_SYSTEM_ID)
AND HIST.LDR_SYSTEM_ID NOT IN (SELECT SYSTEM_ID FROM GM_SYSTEM) /* SYSTEM_ID is the PK for GM_SYSTEM */
AND HIST.SYSTEM_HIST_ID IN
(SELECT SYSTEM_HIST_ID FROM GM_INTGRTY_INVN
UNION
SELECT SYSTEM_HIST_ID FROM GM_INTGRTY_PROXIMITY);
SELECT HIST.LDR_SYSTEM_ID "MISSING SYSTEM PK"
FROM GM_SYSTEM_HIST HIST
WHERE HIST.SYSTEM_HIST_ID = (SELECT MIN (DUPL.SYSTEM_HIST_ID) /* SYSTEM_HIST_ID is the PK for GM_SYSTEM_HIST */
FROM GM_SYSTEM_HIST DUPL
WHERE HIST.LDR_SYSTEM_ID = DUPL.LDR_SYSTEM_ID)
AND HIST.LDR_SYSTEM_ID NOT IN (SELECT SYSTEM_ID FROM GM_SYSTEM) /* SYSTEM_ID is the PK for GM_SYSTEM */
AND HIST.SYSTEM_HIST_ID IN
(SELECT SYSTEM_HIST_ID FROM GM_INTGRTY_INVN
UNION
SELECT SYSTEM_HIST_ID FROM GM_INTGRTY_PROXIMITY);
MISSING SYSTEM PK
411539
610343
311152
311155
431231
631785
6 rows selected.
MISSING SYSTEM PK
332000
612339
2 rows selected.
Why would the result sets change from MAX to MIN?Bob from Austin wrote:
I was expecting the identical result sets from the following two SQL statements:And why would they be the same? Assume table GM_SYSTEM_HIST has:
SYSTEM_HIST_ID LDR_SYSTEM_ID
1 10
2 10
3 10Now, even though resgrless if you use MAX or MIN you will get back LDR_SYSTEM_ID = 10, using MAX will return row
3 10while using MIN will return row:
1 10And it could be row
3 10satisfies other where clause conditions:
AND HIST.LDR_SYSTEM_ID NOT IN (SELECT SYSTEM_ID FROM GM_SYSTEM) /* SYSTEM_ID is the PK for GM_SYSTEM */
AND HIST.SYSTEM_HIST_ID IN (
SELECT SYSTEM_HIST_ID FROM GM_INTGRTY_INVN
UNION
SELECT SYSTEM_HIST_ID FROM GM_INTGRTY_PROXIMITY
);while row
1 10does not. Or vice versa.
SY.
Edited by: Solomon Yakobson on Dec 16, 2009 2:49 PM -
How to get the table name of a field in a result set
hi!
i have a simple sql query as
select tbl_customerRegistration.*, tbl_customerAddress.address from tbl_customerRegistration, tbl_customerAddress where tbl_customerAddress.customer_id = tbl_customerRegistration.customer_ID
this query executes well and gets data from the database when i get ResultsetMetaData from my result set (having result of above query) i am able to get the field name as
ResultSetMetaData rsmd = rs.getMetaData();//rs is result set
String columnName = rsmd.getColumnName(1);
here i get columnName = "Customer_id"
but when i try to get the tabel name from meta data as
String tableName = rsmd.getTableName(1); i get empty string in table name....
i want to get the table name of the respective field here as it is very important to my logic.....
how can i do that.....
please help me in that regard as it is very urgent
thanks in advance
sajjad ahmed paracha
you may also see the discussion on following link
http://forum.java.sun.com/thread.jspa?threadID=610200&tstart=0So far as I'm aware, you can't get metadata information about the underlying tables in a query from Oracle and/or the Oracle drivers. I suspect, in fact, that the driver would have to have its own SQL parser to get this sort of information.
I'm curious though-- how do you have application logic that depends on the name of the source table but not know in the application what table is involved? Could you do something "cheesy" like
SELECT 'tbl_customerRegistration' AS tbl1_name,
tbl_customerRegistration.*
...Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC
Maybe you are looking for
-
Studio Display 21" with Mac Mini?
I am considering getting a Mac Mini as an economical upgrade to my B/W G3 system but I want to make sire that my monitor is going to work with it. I have the origingal blue and white 21" Studio Display. the System Profiler says this...... Displays: S
-
IMovie for iOS not finding videos since update to iOS 5.1
Hello everybody, I just updated my iPhone 4 to iOS 5.1 to be able to get the newest iMovie for iOS update. The iOS Update as the iMovie Update went fine so far. But when I try to open projects I have made, iMovie just shows a yellow triangle and says
-
How to send a copy of a document via Gmail?
Hello, After the update to iOS 8.1, I can see the option to send a copy of the document via email. In my case I was able to send the document via Yahoo mail app installed on the device. However, I cannot send through the GMail app installed. I am not
-
Forgot the password and no longer have the original computer how can i reset my ipad?
I forgot the password and i don't have the original computer to reset my ipad How can i do a complete restore? I tried to do a restore but it wont allow me to do a recovery without the password.
-
How can I open one window in Safari with a tab?
When I open Safari, the window opens up but not in a tab. I prefer the single window being in a tab.