ResultSet closes prematurely

Hi,
I'm using Weblogic 7.0 SP4 with Oracle Driver Type 4 to access database. When
I try to execute any prepare statement and iterate through my resultset, i get
the following error message. I didn't have this problem when I use Weblogic 6.1
SP4 or Weblogic 8.1, I only get this when I try to use Weblogic 7.0. Does any
one experienced any issues like this? what are the possible causes?
java.sql.SQLException: Closed Resultset: next
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:1129)
at oracle.jdbc.driver.OracleResultSetImpl.next(OracleResultSetImpl.java:
196)
at weblogic.jdbc.pool.ResultSet.next(ResultSet.java:205)
at com.qwest.abacus.general.dao.OracleNetworkComponentDAO.getOnNetCityLi
st(OracleNetworkComponentDAO.java:469)
at com.qwest.abacus.general.OnNetCache.loadCache(OnNetCache.java:33)
at com.qwest.abacus.common.AbacusWLProperties.startup(AbacusWLProperties
.java:220)
at weblogic.t3.srvr.StartupClassService.invokeStartup(StartupClassServic
e.java:158)
at weblogic.t3.srvr.StartupClassService.invokeClass(StartupClassService.
java:139)
at weblogic.t3.srvr.StartupClassService.access$0(StartupClassService.jav
a:130)
at weblogic.t3.srvr.StartupClassService$1.run(StartupClassService.java:1
02)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServic
eManager.java:685)
at weblogic.t3.srvr.StartupClassService.invokeStartupClass(StartupClassS
ervice.java:97)
at weblogic.t3.srvr.StartupClassService.resume(StartupClassService.java:
76)
at weblogic.t3.srvr.ServerLifeCycleList.resume(ServerLifeCycleList.java:
67)
at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:832)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:300)
at weblogic.Server.main(Server.java:32)
Thanks,
-Babu

Hi,
Could you show us what you do at
PricingConstants.loadComponentTypes
Slava
"Babu" <[email protected]> wrote in message news:[email protected]...
>
Hello,
Thanks for the response. I just downloaded from the oracle site latest
version of classes12.zip,even then i get the following exception:
java.sql.SQLException: Closed Resultset: next
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:1129)
at oracle.jdbc.driver.OracleResultSetImpl.next(OracleResultSetImpl.java:
196)
at weblogic.jdbc.pool.ResultSet.next(ResultSet.java:205)
at com.qwest.abacus.quoting.utility.PricingConstants.loadComponentTypes(
PricingConstants.java:226)
at com.qwest.abacus.quoting.utility.PricingConstants.initializeCache(Pri
cingConstants.java:87)
at com.qwest.abacus.quoting.utility.PricingConstants.<init>(PricingConst
ants.java:71)
at com.qwest.abacus.quoting.utility.PricingConstants.getCompTypeId(Prici
ngConstants.java:890)
at com.qwest.abacus.pricing.PricedObjectQuoter.setCompClass(PricedObject
Quoter.java:217)
at com.qwest.abacus.pricing.PricedObjectQuoter.evaluateAndInitializeForP
ricing(PricedObjectQuoter.java:308)
at com.qwest.abacus.pricing.LocalAccessQuoter.evaluateAndInitializeForPr
icing(LocalAccessQuoter.java:296)
at com.qwest.abacus.pricing.ConfigurationQuoter.priceComponent(Configura
tionQuoter.java:173)
at com.qwest.abacus.access.atm.QuoteThread.priceConfiguration(QuoteThrea
d.java:152)
at com.qwest.abacus.access.atm.QuoteThread.run(QuoteThread.java:68)
Error received from QuoteThread: com.qwest.abacus.pricing.exception.ComponentPri
cingException: Caught an SQLException while populating the component_type_ids
in PricingConstants.
Any ideas?
Thanks,
-Babu
Joe Weinstein <[email protected]> wrote:
Babu wrote:
Hi,
I'm using Weblogic 7.0 SP4 with Oracle Driver Type 4 to accessdatabase. When
I try to execute any prepare statement and iterate through my resultset,i get
the following error message. I didn't have this problem when I useWeblogic 6.1
SP4 or Weblogic 8.1, I only get this when I try to use Weblogic 7.0.Does any
one experienced any issues like this? what are the possible causes?Hi. I suspect the oracle driver. If it were the pool driver, the exception
would have come from the pool ResultSet object. The first thing to do
is to
download Oracle's latest appropriate thin driver, and get it listed at
the
front of the -classpath argument that the startWebLogic script creates
for the
java line that starts the server.
Joe
java.sql.SQLException: Closed Resultset: next
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:1129)
at oracle.jdbc.driver.OracleResultSetImpl.next(OracleResultSetImpl.java:
196)
at weblogic.jdbc.pool.ResultSet.next(ResultSet.java:205)
at com.qwest.abacus.general.dao.OracleNetworkComponentDAO.getOnNetCityLi
st(OracleNetworkComponentDAO.java:469)
at com.qwest.abacus.general.OnNetCache.loadCache(OnNetCache.java:33)
at com.qwest.abacus.common.AbacusWLProperties.startup(AbacusWLProperties
.java:220)
at weblogic.t3.srvr.StartupClassService.invokeStartup(StartupClassServic
e.java:158)
at weblogic.t3.srvr.StartupClassService.invokeClass(StartupClassService.
java:139)
at weblogic.t3.srvr.StartupClassService.access$0(StartupClassService.jav
a:130)
at weblogic.t3.srvr.StartupClassService$1.run(StartupClassService.java:1
02)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServic
eManager.java:685)
at weblogic.t3.srvr.StartupClassService.invokeStartupClass(StartupClassS
ervice.java:97)
at weblogic.t3.srvr.StartupClassService.resume(StartupClassService.java:
76)
at weblogic.t3.srvr.ServerLifeCycleList.resume(ServerLifeCycleList.java:
67)
at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:832)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:300)
at weblogic.Server.main(Server.java:32)
Thanks,
-Babu

Similar Messages

  • Finalizer blocks on a jconnect resultset close

    We are using weblogic 6.1 sp6. We encounter a strange problem of weblogic sometimes
    getting outofmemory errors. Stack trace dumps during the problem time shows the
    finalizer thread waiting on a socket read on ResultSet.close.
    Checking connections on Sybase showed that all connections from weblogic were
    idle and were in awaiting command state. Killing the sybase connection for the
    resultset close method enabled finalizer to continue and memory was reclaimed.
    Checking the application code showed that the application had leaked a resultset
    and the connection object, a javap on weblogic.jdbc.pool.ResultSet shows that
    in SP6 the finalize method has been implemented.
    Any ideas or clues what caused this scenario would be very much appreciated.

    kader wrote:
    We are using weblogic 6.1 sp6. We encounter a strange problem of weblogic sometimes
    getting outofmemory errors. Stack trace dumps during the problem time shows the
    finalizer thread waiting on a socket read on ResultSet.close.
    Checking connections on Sybase showed that all connections from weblogic were
    idle and were in awaiting command state. Killing the sybase connection for the
    resultset close method enabled finalizer to continue and memory was reclaimed.
    Checking the application code showed that the application had leaked a resultset
    and the connection object, a javap on weblogic.jdbc.pool.ResultSet shows that
    in SP6 the finalize method has been implemented.
    Any ideas or clues what caused this scenario would be very much appreciated.Not sure if this relevant to your question: we find that if you do not
    close() statements and prepared statements jConnects leaks
    BufferInterval instances. Do you find you have a large number of
    BufferInterval (a jConnect internal class) instances? What is the actual
    cause of the OutOfMemory error?
    Robert

  • Slow ResultSet.close() & Statement.close()

    Hi, JDBC Team.
    I use thin JDBC driver.
    Sometimes Statement.close() , ResultSet.close() , ResultSet.next() (for last record) methods runs VERY slow. Pauses appear on oracle.jdbc.ttc7.Oclose.receive() (while reading from socket?).
    Thanks

    You mentioned that you explicitly closed your resultsets and statements...BUT you did not say anything about the connection objects that are associated with the resultsets and statements. It also matters that you do this in the finally{} section of your try/catch/finally, since that would ensure that these resources ALWAYS get released.

  • Sapscript Form closes prematurely

    I copied and edited standard form PM_COMMON to accomodate requirement for custom Job Ticket.
    However, when I set that in OIDF, the Job Ticket print fails (print or print preview).
    I traced the problem to the standard program RIPRJT00.
    it enters FORM print_paper, then to FORM main_print. Below is its source code
    FORM main_print.
    *... Workpaper is controlled at a HEADER LEVEL  (ORDERS)
    *... Brief details from Order, detail opertion information
      PERFORM set_gv_arc_type_aufk USING caufvd-auart.          "n766146
    *... and materials needed in Operation are listed
    * start of node 766146:
    * PERFORM OPEN_FORM  USING C_ARC_TYPE_AUFK "Archive link for order.
      PERFORM open_form  USING gv_arc_type_aufk "Archive link for order
    * end of node 766146
                               caufvd-aufnr" order obj number as key
                               ' '.        " New form for each Order
    " ... removed fragments for conciseness
      PERFORM operations_with_mat. " reservations are printed with Op.
      PERFORM end_of_report.               " Print end of report line
      PERFORM close_form.                  " Close the form.
      PERFORM unlock_and_log.              " Dequeue and Log print
    ENDFORM.                    "MAIN_PRINT
    Then it enters FORM operations_with_mat, then a call to function module WRITE_FORM. It fails in line 40 of the FM WRITE_FORM where it checks if the form is closed
    40  if rstxc-tdclose = true.
    41    call function 'SAPSCRIPT_MESSAGE_DEF'
    42         exporting no = 443
    43                   v1 = 'WRITE_FORM'.
    44    perform exception.
    45    message a443 with 'WRITE_FORM' raising unstarted.
    46  endif.
    I don't know how, but PERFORM operations_with_mat is between PERFORM open_form and PERFORM close_form.
    Do you know any reasons why rstxc-tdclose would set to 'X'?
    Edited by: Kyle Domingo on Mar 17, 2010 9:47 AM

    Hi
    Did you adjust the window size after copying the standard script?? This seems to be an issue with formatting. So, check the formatting is perfect. Check If the window size is not more than size of the page,also check for overflow.
    Also check,If there is any error in the script.
    Vishwa.

  • ConnectionPool problems with WLS 7.0 and Oracle 9.2

    Hi,
    We are using WLS 7.0 SP4, and Oracle 9 and the Oracle thin driver type 4. In our
    application on the productive system (and only there) we constantly encounter
    a whole set of SQLExceptions which have all in common that the Connection from
    the pool is not valid any more when the application tries to use it.
    Typical, recurring error messages are:
    - Exhausted ResultSet
    - Connection has already been closed
    - Closed Statement
    - Transaction is no longer active - status committing
    - NullPointerException at
    weblogic.jdbc.pool.Connection.prepareStatement()
    There are no special Statements which create these errors. They are spread at
    random across practically every query the application creates, and the same queries
    sometimes succeed and sometimes fail.
    I double and triple checked that all Connections, Statements and ResultSets are
    closed immediately after use. As an example, I attached a code snippet and a resulting
    StackTrace which.
    The problem also seems to occur only with an (unknown) minimum of concurrent usern,
    since in the approval tests on an almost identical test system these errors never
    occurred.
    I also followed the advice from Oracle and installed the latest Oracle JDBC driver
    (Oracle 10g) - to no avail.
    What else can I do?
    Another question: Is it correct that my Oracle JDBC driver is in the application
    classpath (via a reference in the Manifest file of the application jar), not in
    the system classpath? There has never been a problem with that, but in a Newsgroup
    answer from Nov 10, 2003 (subject: "ResultSet closes prematurely"), Joe Weinstein
    suggested to "get it listed at the
    front of the -classpath argument that the startWebLogic script creates for the
    java line that starts the server".
    I hesitate to do so, since the driver is in a standard WebApp- directory, WEB-INF/lib.
    Is it possible and safe to add a jar located there to the system classpath? If
    it is possible, why is it necessary?
    Best regards,
    Andreas Zehrt
    [CodeSnippetsAndStackTraceForConnectionPoolProblem.txt]

    Andreas Zehrt wrote:
    Hi Joe,
    Your hint that there is a threading problem was right:
    On further investigation of the code I found out that the class that passes the
    Connection to the DAO not only stores it as a member at some point (which is not
    a good idea anyway) but is also a singleton - then, of course, it's no surprise
    that the Connection gets invalid in a incalculable way when concurrent threads
    share it.
    The singleton instantiation was not so obvious because the way of instantiation
    is controlled by a configuration parameter that can be overridden at different
    levels.
    I changed it and the productive logfiles indicate that the SQLExceptions related
    to that class have disappeared.I am happy to have helped.
    So, thanks a lot for the advice.
    But I am still wondering why this code has worked for so long a time with WLS
    5.1 and Oracle 8 (the system has been productive for over 2 years). Even in the
    approval tests with WLS 7.0 and Oracle 9, we did not run into problems, although
    it was multi-user environment.Mo idea.
    I still believe that there is a difference between WLS 5.1 and 7.0 in the way
    it treats pooled Oracle JDBC Connections. I wished both Oracle and Bea could be
    a little more explicit about those changes and possible version incompatabilities
    beyond the general advice "use the latest thin driver".Though I can think of no change to our pooling which would have had any material
    effect in this case, I will certainly do what I can to see that our documentation
    is explicit about changes.
    Joe
    Best regards, Andreas
    Joe Weinstein <[email protected]> wrote:
    Hi Andreas.
    Andreas Zehrt wrote:
    Hi,
    We are using WLS 7.0 SP4, and Oracle 9 and the Oracle thin driver type4. In our
    application on the productive system (and only there) we constantlyencounter
    a whole set of SQLExceptions which have all in common that the Connectionfrom
    the pool is not valid any more when the application tries to use it.
    Typical, recurring error messages are:
    - Exhausted ResultSetThat is typically if the statement that created it is either re-executed
    or closed.
    - Connection has already been closedAs described. If you give a stacktrace, we could make a debug patch which
    would show
    where it was originally closed.
    - Closed Statementsame as above.
    - Transaction is no longer active - status committingThat implies your code is obtaining a connection from a transactional
    datasource,
    and then later trying to use it after the transaction which it was associated
    with,
    is finished.
    - NullPointerException at
    weblogic.jdbc.pool.Connection.prepareStatement()Maybe any of the above.
    There are no special Statements which create these errors. They arespread at
    random across practically every query the application creates, andthe same queries
    sometimes succeed and sometimes fail.
    I double and triple checked that all Connections, Statements and ResultSetsare
    closed immediately after use. As an example, I attached a code snippetand a resulting
    StackTrace which.
    The problem also seems to occur only with an (unknown) minimum of concurrentusern,
    since in the approval tests on an almost identical test system theseerrors never
    occurred.
    I also followed the advice from Oracle and installed the latest OracleJDBC driver
    (Oracle 10g) - to no avail.
    What else can I do?
    Another question: Is it correct that my Oracle JDBC driver is in theapplication
    classpath (via a reference in the Manifest file of the applicationjar), not in
    the system classpath? There has never been a problem with that, butin a Newsgroup
    answer from Nov 10, 2003 (subject: "ResultSet closes prematurely"),Joe Weinstein
    suggested to "get it listed at the
    front of the -classpath argument that the startWebLogic script createsfor the
    java line that starts the server".
    I hesitate to do so, since the driver is in a standard WebApp- directory,WEB-INF/lib.
    Is it possible and safe to add a jar located there to the system classpath?If
    it is possible, why is it necessary?I was only concerned to ensure we know which driver we are working with.
    We also ship
    an oracle thin driver, which becomes obsolete soon...
    I am concerned that your code creates pool connections to be used later.
    The problems
    can arise if more than one thread ever gets the same connection, or if
    the connection
    is used in the same thread, spanning transactions. It does also seem
    that there may
    be a threading issue, because if two threads each call the code to create
    a connection,
    and two connections are made, but one over-writes the other, the two
    threads can
    end up using the same connection, and closing it. The over-written one
    never gets closed,
    resulting in that leak message you got...
    Joe
    The Connection parameter is opened by a business component class, ComaServiceProviderClassicImpl.It is propagated through
    several classes in the business layer, but not used, until the DAOtakes it to make the query.
    So, the Connection is closed where it was opened, not in the DAO class.
    public class ConcernDAOImpl extends BaseDAO {
         public Collection getConcernsForIncidents(Connection conn, Collectionincidents)
    throws DataAccessException, ConstraintException, ComaParseException{>
    sqlMessage.append(")");
    String sqlStmt = sqlMessage.toString();
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
    pstmt = conn.prepareStatement(sqlStmt);
    rs = pstmt.executeQuery();
    while (rs != null && rs.next()) {
    final Concern concern =
    new Concern(DAOUtil.getComaOID(rs, ComaDBNames.KDANR));
    concern.setIncidentOID(DAOUtil.getComaOID(rs, ComaDBNames.KDAVGENR));
    return concerns;
    } catch (SQLException sqle) {
    // Wrapps real SQL exception
    String[] message = new String[]{sqle.getMessage(), sqlStmt};
    throw new DataAccessException(ExpCode.S_ORACLE_SQL, message,
    sqle);
    } finally {
    closeAll(rs, pstmt);
    _logger.exitDebug(method);
    Here, the Connection is acquired and finally closed
    public class ComaServiceProviderClassicImpl {
         public void updateComplaint(
    final Request updateRequest,
    final ResponseSingleElement response,
    final Principal principal)
    throws SystemException {
    try {
    logger.info("updateComplaint", "store incident");
    // store the incident in the database
    incidentManager.storeIncident(getConnection(), updateIncident);
    // reload the incident from Cache and / or the databaseto get the ContactReferences.
    Incident returnIncident = incidentManager.loadIncident(//IncidentManager passes the Connection to the DAO
    getConnection(), updateIncident.getOID());
    } catch (RemoteException rex) {
    // remote exceptions
    rollbackIfNecessary();
    CoreUtils.unwrapRemoteException(rex, logger);
    } catch (SystemException e) {
    // all other exceptions --> rollback if necessary and rethrow
    rollbackIfNecessary();
    throw e;
    } finally {
    removeConnection();
    logger.exitDebug("updateComplaint");
    This is the resulting StackTrace:
    sql exception: [Closed Statement: next] - sql statement: [select *
         at de.deutschepost.ubbrief.coma.persistence.dao.ConcernDAOImpl.getConcernsForIncidents(ConcernDAOImpl.java:363)
         at de.deutschepost.ubbrief.coma.persistence.dao.CachingConcernDAOImpl.getConcernsForIncidents(CachingConcernDAOImpl.java:129)
         at de.deutschepost.ubbrief.coma.persistence.incidentmanager.IncidentManagerImpl.loadConcernStructuresIntoIncidents(IncidentManagerImpl.java:1067)
         at de.deutschepost.ubbrief.coma.persistence.incidentmanager.IncidentManagerImpl.loadStructureForIncident(IncidentManagerImpl.java:320)
         at de.deutschepost.ubbrief.coma.persistence.incidentmanager.IncidentManagerImpl.loadIncidents(IncidentManagerImpl.java:264)
         at de.deutschepost.ubbrief.coma.persistence.taskmanager.TaskManagerImpl.selectTasksForUser(TaskManagerImpl.java:299)
         at de.deutschepost.ubbrief.coma.service.z2.ComaServiceProviderZ2Impl.getTaskList(ComaServiceProviderZ2Impl.java:113)
         at de.deutschepost.ubbrief.coma.service.z2.ComaServiceProviderZ2Bean_1dhrj7_EOImpl.getTaskList(ComaServiceProviderZ2Bean_1dhrj7_EOImpl.java:154)
         at de.deutschepost.ubbrief.coma.sbba.z2.CMPGetTaskList.runServiceMethod(CMPGetTaskList.java:64)
         at de.deutschepost.ubbrief.coma.sbbx.sp.BasicMethodProvider.execute(BasicMethodProvider.java:145)
         at de.deutschepost.ubbrief.coma.sbba.z2.CMPGetTaskList_9b9mv5_EOImpl.execute(CMPGetTaskList_9b9mv5_EOImpl.java:46)
         at de.deutschepost.ubbrief.coma.sbba.z2.CMPGetTaskList_9b9mv5_EOImpl_WLSkel.invoke(UnknownSource)
         at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:159)
         at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:263)
         at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:230)
         at de.deutschepost.ubbrief.coma.sbba.z2.CMPGetTaskList_9b9mv5_EOImpl_WLStub.execute(UnknownSource)
         at de.deutschepost.ubbrief.backbone.jazz.impl.core.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:115)
         at de.deutschepost.ubbrief.backbone.common.impl.core.rpc.server.ServerKernelImpl.handleTransportMessage(ServerKernelImpl.java:270)
         at de.deutschepost.ubbrief.backbone.common.impl.core.messaging.MessageTransport.handleMessage(MessageTransport.java:454)
         at de.deutschepost.ubbrief.backbone.common.impl.core.KernelFacade.handleMessage(KernelFacade.java:209)
         at de.deutschepost.ubbrief.backbone.jazz.impl.backbone.BackboneBean.messageArrived(BackboneBean.java:637)
         at de.deutschepost.ubbrief.backbone.jazz.impl.backbone.BackboneBean_ina9d7_ELOImpl.messageArrived(BackboneBean_ina9d7_ELOImpl.java:105)
         at de.deutschepost.ubbrief.backbone.jazz.impl.transport.receive.LocalQueueReceiveBean.deliverMessage(LocalQueueReceiveBean.java:43)
         at de.deutschepost.ubbrief.backbone.jazz.impl.transport.receive.AbstractMessageReceiveBean.onMessage(AbstractMessageReceiveBean.java:127)
         at weblogic.ejb20.internal.MDListener.execute(MDListener.java:377)
         at weblogic.ejb20.internal.MDListener.transactionalOnMessage(MDListener.java:311)
         at weblogic.ejb20.internal.MDListener.onMessage(MDListener.java:286)
         at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:2351)
         at weblogic.jms.client.JMSSession.execute(JMSSession.java:2267)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:234)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:210)
    ####<May 26, 2004 12:18:43 PM CEST> <Warning> <JDBC> <S0048016> <REMA20Z><Finalizer> <kernel identity> <> <001074> <A JDBC pool connection leak
    was detected. A Connection leak occurs when a connection obtained from
    the pool was not closed explicitly by calling close() and then was disposed
    by the garbage collector and returned to the connection pool. The following
    stack trace at create shows where the leaked connection was created.
    Stack trace at connection create:
         at weblogic.jdbc.pool.Connection.<init>(Connection.java:66)
         at weblogic.jdbc.pool.Driver.allocateConnection(Driver.java:294)
         at weblogic.jdbc.pool.Driver.connect(Driver.java:210)
         at weblogic.jdbc.jts.Driver.getNonTxConnection(Driver.java:373)
         at weblogic.jdbc.jts.Driver.connect(Driver.java:129)
         at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:287)
         at de.deutschepost.ubbrief.coma.core.ComaComponentImpl.getConnectionFromPool(ComaComponentImpl.java:163)
         at de.deutschepost.ubbrief.coma.core.ComaComponentImpl.getConnectionInternal(ComaComponentImpl.java:135)
         at de.deutschepost.ubbrief.coma.core.ComaComponentImpl.getConnection(ComaComponentImpl.java:99)
         at de.deutschepost.ubbrief.coma.persistence.customermanager.CurryCustomerManagerImpl.findCustomers(CurryCustomerManagerImpl.java:73)
         at de.deutschepost.ubbrief.coma.service.z2.ComaServiceProviderZ2BaseImpl.resolveCustomerInstances(ComaServiceProviderZ2BaseImpl.java:808)
         at de.deutschepost.ubbrief.coma.service.z2.ComaServiceProviderZ2Impl.getTaskList(ComaServiceProviderZ2Impl.java:213)
         at de.deutschepost.ubbrief.coma.service.z2.ComaServiceProviderZ2Bean_1dhrj7_EOImpl.getTaskList(ComaServiceProviderZ2Bean_1dhrj7_EOImpl.java:154)
         at de.deutschepost.ubbrief.coma.sbba.z2.CMPGetTaskList.runServiceMethod(CMPGetTaskList.java:64)
         at de.deutschepost.ubbrief.coma.sbbx.sp.BasicMethodProvider.execute(BasicMethodProvider.java:145)
         at de.deutschepost.ubbrief.coma.sbba.z2.CMPGetTaskList_9b9mv5_EOImpl.execute(CMPGetTaskList_9b9mv5_EOImpl.java:46)
         at de.deutschepost.ubbrief.coma.sbba.z2.CMPGetTaskList_9b9mv5_EOImpl_WLSkel.invoke(UnknownSource)
         at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:159)
         at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:263)
         at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:230)
         at de.deutschepost.ubbrief.coma.sbba.z2.CMPGetTaskList_9b9mv5_EOImpl_WLStub.execute(UnknownSource)
         at de.deutschepost.ubbrief.backbone.jazz.impl.core.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:115)
         at de.deutschepost.ubbrief.backbone.common.impl.core.rpc.server.ServerKernelImpl.handleTransportMessage(ServerKernelImpl.java:270)
         at de.deutschepost.ubbrief.backbone.common.impl.core.messaging.MessageTransport.handleMessage(MessageTransport.java:454)
         at de.deutschepost.ubbrief.backbone.common.impl.core.KernelFacade.handleMessage(KernelFacade.java:209)
         at de.deutschepost.ubbrief.backbone.jazz.impl.backbone.BackboneBean.messageArrived(BackboneBean.java:637)
         at de.deutschepost.ubbrief.backbone.jazz.impl.backbone.BackboneBean_ina9d7_ELOImpl.messageArrived(BackboneBean_ina9d7_ELOImpl.java:105)
         at de.deutschepost.ubbrief.backbone.jazz.impl.transport.receive.LocalQueueReceiveBean.deliverMessage(LocalQueueReceiveBean.java:43)
         at de.deutschepost.ubbrief.backbone.jazz.impl.transport.receive.AbstractMessageReceiveBean.onMessage(AbstractMessageReceiveBean.java:127)
         at weblogic.ejb20.internal.MDListener.execute(MDListener.java:377)
         at weblogic.ejb20.internal.MDListener.transactionalOnMessage(MDListener.java:311)
         at weblogic.ejb20.internal.MDListener.onMessage(MDListener.java:286)
         at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:2351)
         at weblogic.jms.client.JMSSession.execute(JMSSession.java:2267)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:234)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:210)

  • Implicit vs explicit close of resultsets and statements?

    Hi friends.I am a newbie Java Developer..Okay Here goes
    I have just made a LAN based Java application using Swing,JDBC with backend as MS-Access..The backend is on a shared network drive..
    The application is distributed as jar files on the LAN PCs..
    Everywhere I have connected to the database I have just closed the connection explicitly like this
    con.close();
    I do not close the associated resultset and statement explicitly
    The specification says associated statements and resultsets close when you close
    the connection,even if you don't explicitly close them
    Also I am not using connection pool..its simple basic connection using DriverManager
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String url = "jdbcdbcSN name";
    String user = "";
    String pw = "";
    con = DriverManager.getConnection(url, user, pw);
    Statement stmt = con.createStatement();
    String select = "" ;
    ResultSet rows = stmt.executeQuery(select);
    On the net everyone says to explicitly close everything..but I did not know that
    earlier..
    If specification says everything closes on
    closing connection why do ppl insist on closing everything explicitly..?
    Or is this driver dependent..don't the drivers go through the specification..
    My driver is the Sun JDBC ODBC bridge.....
    I found this method DriverManager.setLogwriter()
    It prints out a trace of all JDBC operations..
    So I ran a sample program with this method included...
    I redirected output to a log file..
    In that program I just explicitly close the connection without closing the
    statements and resultsets explicitly...
    After running the program and seeing the log I saw that the statements
    and resultsets are closed implicitly If I just close the connection explicitly..
    I am putting the log file and the code..
    Have a look at the end of the log file..
    Code
    import java.sql.;
    import java.io.;
    class gc4test
    public static void main(String args[])
    Connection con = null;
    try
    FileWriter fwTrace = new FileWriter("c:\\log.txt");
    PrintWriter pwTrace= new PrintWriter(fwTrace);
    DriverManager.setLogWriter(pwTrace);
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String url = "jdbc:odbc:pravahcon";
    String user = "admin";
    String pw = "ash123";
    con = DriverManager.getConnection(url, user, pw);
    Statement stmt = con.createStatement();
    Statement stmt1 = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
    Statement stmt2 = con.createStatement();
    Statement stmt3 = con.createStatement();
    Statement stmt4 = con.createStatement();
    Statement stmt5 = con.createStatement();
    Statement stmt6 = con.createStatement();
    Statement stmt7 = con.createStatement();
    String select = "SELECT * FROM Users" ;
    ResultSet rows = stmt.executeQuery(select);
    ResultSet rows1 = stmt1.executeQuery(select);
    while(rows.next())
    con.close();
    catch (ClassNotFoundException f)
    System.out.println(f.getMessage());
    System.exit(0);
    catch (SQLException g)
    System.out.println(g.getMessage());
    System.exit(0);
    catch (Exception e)
    System.out.println(e.getMessage());
    System.exit(0);
    End of Log File
    Setting statement option (SQLSetStmtAttr), hStmt=50275112, fOption=25
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    Fetching (SQLFetch), hStmt=50274224
    End of result set (SQL_NO_DATA)
    *Connection.close
    8 Statement(s) to close
    *Statement.close
    Free statement (SQLFreeStmt), hStmt=50281544, fOption=1
    deregistering Statement sun.jdbc.odbc.JdbcOdbcStatement@2e7263
    *Statement.close
    Free statement (SQLFreeStmt), hStmt=50277224, fOption=1
    deregistering Statement sun.jdbc.odbc.JdbcOdbcStatement@1bf216a
    *Statement.close
    *ResultSet.close
    *ResultSet has been closed
    Free statement (SQLFreeStmt), hStmt=50274224, fOption=1
    deregistering Statement sun.jdbc.odbc.JdbcOdbcStatement@156ee8e
    *Statement.close
    Free statement (SQLFreeStmt), hStmt=50280464, fOption=1
    deregistering Statement sun.jdbc.odbc.JdbcOdbcStatement@c20e24
    *Statement.close
    Free statement (SQLFreeStmt), hStmt=50278304, fOption=1
    deregistering Statement sun.jdbc.odbc.JdbcOdbcStatement@12ac982
    *Statement.close
    *ResultSet.close
    *ResultSet has been closed
    Free statement (SQLFreeStmt), hStmt=50275112, fOption=1
    deregistering Statement sun.jdbc.odbc.JdbcOdbcStatement@e0e1c6
    *Statement.close
    Free statement (SQLFreeStmt), hStmt=50276144, fOption=1
    deregistering Statement sun.jdbc.odbc.JdbcOdbcStatement@6ca1c
    *Statement.close
    Free statement (SQLFreeStmt), hStmt=50279384, fOption=1
    deregistering Statement sun.jdbc.odbc.JdbcOdbcStatement@1389e4
    Disconnecting (SQLDisconnect), hDbc=50271048
    Closing connection (SQLFreeConnect), hDbc=50271048
    Closing environment (SQLFreeEnv), hEnv=50270880
    So like what these implicitly closed statements and resultsets are different from explicitly closed
    resultsets and statements..?

    Please do not crosspost/doublepost the same question again. It is rude in terms of netiquette.
    Stick to one topic: [http://forums.sun.com/thread.jspa?threadID=5393387&messageID=10745794#10745794].

  • Checking if resultset still active?

    I want to return a ResultSet which basically handles some query i.e.
    public ResultSet doSomething(int chr, int startPos, int endPos, int strainsThreshold, float minGeneDensity) throws SQLException {
                    String someQuery = "";          
              // this should force incremental streaming of a large result set
              if(conn != null){
              stmt = conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY,
                       java.sql.ResultSet.CONCUR_READ_ONLY);
              stmt.setFetchSize(Integer.MIN_VALUE);
              return stmt.executeQuery(someQuery);
              }else
              return null;
         }This is running in a web application. However, if I stop a query running halfway through e.g. by pressing the stop button on the browser and then re-run the query the current resultSet is still active and throws an exception. Checking the API states that when the statement is fully executed the resultSet will be closed automatically but in this case it isn't. Is there any way of checking whether the resultSet is active or a way of closing it if a query ends prematurely?

    I suspect you need to change your function so it is tread safe. That way, a second sql request can be made even if the first one is pending. In your function, do the following (note all variables except dataSource are local variables so its thread safe): Note you can't return the resultSet because its closed within the function before the function is returned. Instead, copy the data from the resultSet into some type of array. (resultSet.getString("firstName") ) and return the array.
    public ArrayList myFunction(){
    Connection conn=null;
    PreparedStatement pstmt1= null;
    ResultSet resultSet=null
    ArrayList list1=new ArrayList();
    try{
    conn= dataSource.getConnection();
    pstmt1= conn.prepareStatement();
    resultSet= pstmt1.executeQuery();
    while(resultSet.next()){
    arrayList.add(resultSet.getString("lastName");
    return arrayList;
    } catch (SqlException e){
    } finally {
    if(rsultSet!=null)
    resultSet.close();
    if(pstmt1!=null)
    pstmt1.close();
    if(conn!=null)
    conn.close();
    Next, on your JSP page block you submit button from being clicked more than once until the page is re-rendered with the response from the server.
    If your query takes a long time to run and the user would consider trying to kill it, you cant. The database will execute the query to completion. I suggest instead limiting the amount of data fetched so its doesnt take so long. Add a filter to the page. Example: a textfield to filter by last Name. Enter 'B' in the textfield, and programmatically change the sql to 'select * from person where lastName like 'B%'.

  • Please Help !  Exception in closing resultset,statement.

    In an application developed on , i am closing the resultsets and statements in finally block as
    finally {
         if (resultset != null) resultset .close();
         if (statement != null) statement.close();
    the above block does not take care of exceptions that might arise while closing resultset/statement. Please help with this:
    what the conditions exceptions may arise in closing resultset/statements.
    when does the garbage collector free such resources and what are the implications of not catching exception while closing - can this cause database handle leaks.
    Please help!

    I don't know what exceptions might occur, but since the close() method can throw SQLException, your program has to catch it. Maybe if you close twice, the second time will throw an exception? Anyway, it doesn't really matter, you still have to write a try-catch around it. What you do there is up to you -- you could ignore it (which is what I do) or you could end the program with a message.
    When does the garbage collector free those resources? The garbage collector only frees memory. Nothing else. And the garbage collector will free a ResultSet object only when there are no references to it anywhere in your program. That doesn't mean just in code that you wrote, but anywhere in code that's running in your program. For example, the Statement object that produced the ResultSet might hold a reference to it. However, the API documentation for ResultSet does say that when the garbage collector does free a ResultSet object, it will automatically close it.
    However, the best practice is to close ResultSet and Statement objects when you are finished with them, and not rely on garbage collection to clean up after you.

  • Problem Generating a Report by passing a Resultset as a datasource

    I am having troubles generating a report using CR for Eclipse 2.0.
    I used the example that shows how do a simple select SQL query to the database and pass the resultset from the query to the report to generate a report from here: https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/201084dc-be66-2b10-64bf-dde4970c9b90
    I used a simple rpt file that simply shows the content of two columns from a table: TXN_TYPE_CD and TXN_STATUS_CD from a POLICY_TXN table.
    Using the code above, and just modifying it a bit to include my jdbc connection details as well as my select query, I was able to view the report which populated data from my database (Oracle 10g) at runtime of the application.  This test proved positive.
    However, the problem I am having is that I am trying to make this code into a Servlet for use in a Java EE application running on Websphere 6.1.0.17 using JVM 1.5.0_15  64-bit.  Instead of using the DHTML thick client, I export to PDF.  When I do this, the crystal report shows as a PDF, but the data is missing for some reason.  Only the headers for the two db columns are shown.  I don't see any startling differences between the code and am 100% positive that my resultset is being returned with data (I output the data returned in the result set as shown in the code).
    Here is the code I am using:
    public class CrystalReportGeneratorServlet_WOW extends Servlet {
         private static final long serialVersionUID = 768970549082466125L;
         protected HttpSession session;
         private final String EXPORT_FILE = "myExportedReport.pdf";
         private final String CUSTOM_PATH = "/custom/resource/crystalReport/";
         private String REPORT_NAME;
         public void service(HttpServletRequest request, HttpServletResponse response)
                   throws IOException, ServletException {
              Properties loParms = new Properties();
              ResultSet resultSet = null;
              //Obtain current JDBC Connection
              Connection loConn = AppEnvironment.getJDBCConnection();
              Statement statement = null;
              try {
                   REPORT_NAME = "Test.rpt";
                   //Open report
                   ReportClientDocument reportClientDoc = new ReportClientDocument();
                   reportClientDoc.open(SystemConfig.getAppHome() + CUSTOM_PATH + REPORT_NAME, 0);
                   //Create SQL query.    
                   String query = "SELECT \"POLICY_TXN\".\"TXN_TYPE_CD\", \"POLICY_TXN\".\"TXN_STATUS_CD\"" + "FROM   \"POLICY_TXN\"";
                   //Query database and obtain the Resultset that will be pushed into the report.  
                   statement = loConn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
                   //Execute query and return result set.
                   resultSet = statement.executeQuery(query);
                   //Look up existing table in the report to set the datasource for and obtain its alias.  This table must
                   //have the same schema as the Resultset that is being pushed in at runtime.  The table could be created
                   //from a Field Definition File, a Command Object, or regular database table.  As long the Resultset
                   //schema has the same field names and types, then the Resultset can be used as the datasource for the table.
                   String tableAlias = reportClientDoc.getDatabaseController().getDatabase().getTables().getTable(0).getAlias();
                   /////TESTING: OUTPUT contents of resultSet
                   while (resultSet.next()) {
                        System.out.println("TXN_STATUS_CD = " + resultSet.getString("TXN_STATUS_CD"));
                        System.out.println("TXN_TYPE_CD = " + resultSet.getString("TXN_TYPE_CD"));
                   //Push the Java ResultSet into the report.  This will then be the datasource of the report.
                   DatabaseController dbc = reportClientDoc.getDatabaseController();
                   dbc.setDataSource(resultSet, tableAlias , "resultsetTable");
                   //Export to PDF
                   ExportToPDF(reportClientDoc, response);
              catch(ReportSDKException ex) {     
                   System.out.println(ex);
              catch(Exception ex) {
                   System.out.println(ex);               
              } finally {
                   try {
                        resultSet.close();
                   } catch (SQLException e) {
                             e.printStackTrace();
                        } finally {
                             AppEnvironment.returnStatement(statement);
                             AppEnvironment.returnConnection ( loConn ) ;
         private void ExportToPDF(ReportClientDocument rcd, HttpServletResponse response)
              try {
                   ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream)rcd.getPrintOutputController().export(ReportExportFormat.PDF);
                   rcd.close();
                   writeToBrowser(byteArrayInputStream, response, "application/pdf", EXPORT_FILE);
              catch(ReportSDKException ex) {
                   System.out.println(ex);
              catch(Exception ex) {
                   System.out.println(ex);
         * Utility method that demonstrates how to write an input stream to the server's local file system.
         private void writeToBrowser(ByteArrayInputStream byteArrayInputStream, HttpServletResponse response, String mimetype, String exportFile) throws Exception {
              //Create a byte[] the same size as the exported ByteArrayInputStream.
              byte[] buffer = new byte[byteArrayInputStream.available()];
              int bytesRead = 0;
              try{
                   //Set response headers to indicate mime type and inline file.
                   response.setHeader("Content-disposition", "inline;filename=" + exportFile);
                   response.setContentType(mimetype);
                   //Stream the byte array to the client.
                   while((bytesRead = byteArrayInputStream.read(buffer)) != -1) {
                   response.getOutputStream().write(buffer, 0, bytesRead);
                   //Flush and close the output stream.
                   response.getOutputStream().flush();
                   response.getOutputStream().close();
              } catch (Exception e){
                        e.printStackTrace();
         public static Servlet getInstance()
            return new CrystalReportGeneratorServlet_WOW();
    Any help would greatly be appreciated.

    Actually Uzair I came across this thread in trying to find a resolution to my problem.  I was wondering if you were able to resolve this issue as it appears as though I may have the same problem.
    Thanks.

  • No. Of Rows in a resultset

    Is there a method in result which one could use to get the no. of rows in a resultset. I currently get my no. by looping thru the resultset and summing the number of times the loop runs.
    Cheers,
    Havasen

    I don't know if it's driver specific - what can you say what any driver does inside?
    But I think, the most common way should be, that the driver does the same like I and others did it formerly in C programs with embedded SQL:
    Let the DBMS create a cursor for the query.
    Open this cursor - so the DBMS creates a temporary result set inside.
    Position that cursor inside this result set (inside he DBMS).
    Fetch the actual row.
    After finnishing your logic, close the cursor. So the DBMS clears up its temporary result set.
    Now what JDBC presents you as a scrollable result set, should be nothing more than an opened cursor, ready to position on ra single row and fetch it, ... and at the end - when you call ResultSet.close() - close the cursor.
    So each row can stay inside the DBMS, until you cause JDBC to fetch it. I think, this is, when you position on it, and JDBC does some caching and retrieves a couple of rows together - there are methods to control this to a certain degree, like Statement.setFetchSize().
    But the DBMS must hold the cursor and maintain its temporary result set.
    So it's not equal if you cause JDBC to retrieve a complete resultset - and for positioning on the last row, it has to retrieve them all, I fear.
    As I said - I can't promise that your driver will work this way.
    If I would write a JDBC driver, I probably would try it this way. But I haven't yet, and why should I.
    That was the explanation.
    And to the original question:
    For counting the records only, I would never suggest the last() trick, but a simple query on
    "SELECT COUNT(*) FROM table".

  • Cannot read multiple resultsets from transaction datasource

    I get a SQL exception "This object was closed() and cannot be used anymore."
    when I try to access the first row of the second result set from a stored procedure.
    This occurs when the code is running within an EJB using a transaction-capable
    datasource hooked to a connection pool that uses the MSSQLSERVERv7 JDriver
    to talk to SQL Server 7.0.
    I noted that the resultset class used is weblogic.jdbc20.rmi.SerialResultSet.
    The error occurs during the resultSet.next() call even though the resultset is
    not null and getUpdateCount() returns -1.
    However, the same code works correctly when run in a simple main() procedure from
    the DOS command line, connecting directly to the database using only the classes
    supplied with the JDriver product. The resultset class used in this case is
    weblogic.jdbc.mssqlserver4.TdsResultSet.
    The stored procedure is very simple, it just has two lines: SELECT 'Hello' and
    SELECT 'World'. The Java code follows.
    <PRE>
    // ... code to get the connection ...
    CallableStatement callableStatement = connection.prepareCall("{CALL spTest}");
    callableStatement.execute();
    ResultSet resultSet = callableStatement.getResultSet();
    if ((resultSet != null) && resultSet.next())
    System.out.println("Row from first result set:" + resultSet.getString(1));
    callableStatement.getMoreResults();
    resultSet = callableStatement.getResultSet();
    if ((resultSet != null) && resultSet.next()) // this call to next() throws the
    exception
    System.out.println("Row from second result set:" + resultSet.getString(1));
    resultSet.close();
    callableStatement.close();
    connection.close();
    </PRE>
    I am running WL5.10sp11 with mssqlserver4v70sp11 on NT4.0sp6a and JDK1.3.0_02
    (HotSpot Client VM).
    Regards,
    Tom B.

    Tom Bechtold wrote:
    >
    Joe,
    Here is the debug messages and trace with your diagnostic jar.
    I hope this helps - Tom
    we got Hello
    java.sql.SQLException: java.lang.Exception: ResultSet originally closed at:
    at weblogic.jdbcbase.mssqlserver4.TdsResultSet.close(TdsResultSet.java,
    Compiled Code)
    at java.lang.Exception.<init>(Unknown Source)
    at weblogic.jdbcbase.mssqlserver4.TdsResultSet.close(TdsResultSet.java,
    Compiled Code)
    at weblogic.jdbcbase.jts.ResultSet.close(ResultSet.java:260)
    at weblogic.jdbc20.rmi.internal.ResultSetImpl.close(ResultSetImpl.java:53)
    at weblogic.jdbc20.rmi.SerialResultSet.close(SerialResultSet.java:54)
    ... rest of EJB call stack ...Hi. I do want to see the whole stack trace please, and also the EJB code.
    thanks,
    Joe
    >
    Joseph Weinstein <[email protected]> wrote:
    Tom Bechtold wrote:
    Hi Joe,
    I pasted your sample program into my bean and ran it under
    WL510sp11 and JDriver 5.1.0sp11, and it did exhibit the error
    as my code did.
    But it runs fine under WL510sp10 with JDriver 5.1.0sp11.
    Thanks for your great support,
    TomYou're very welcome. Please take the attached jar file, and add it
    at the front of the server's weblogic.classpath, by editting the
    startWebLogic script, and let me know what happens. This jar contains
    the ResultSet class, with a hack to remember where it was closed, and
    print that out if/when it is closed a second time.
    Joe
    Joseph Weinstein <[email protected]> wrote:
    Tom Bechtold wrote:
    A follow-on note: when I back out to Service Pack 10, the problem
    is
    not there,
    so it seems that it is an issue with Service Pack 11.
    - Tom Bechtold
    "Tom Bechtold" <[email protected]> wrote:
    I get a SQL exception "This object was closed() and cannot be used
    anymore."
    when I try to access the first row of the second result set from
    a
    stored
    procedure.
    This occurs when the code is running within an EJB using a transaction-capable
    datasource hooked to a connection pool that uses the MSSQLSERVERv7JDriver
    to talk to SQL Server 7.0.
    I noted that the resultset class used is weblogic.jdbc20.rmi.SerialResultSet.
    The error occurs during the resultSet.next() call even though theresultset
    is not null and getUpdateCount() returns -1.Hi. You say that getUpdateCount() returns -1. I don't see that inthe
    code you sent,
    so you probably just gave us a representative sample of the code you
    run. I did
    runs uch code with the driver alone, and it works as you say. I will
    see if I can
    set up a server to do this via a DataSource, but in case anyone wants
    to help/race with
    me :-), here's simple code to run. If you convert it to a DataSource
    connection,
    and it behaves differently, I'll send you a diagnostic class to seewhat's
    up...
    Joe
    Connection connection = null;
    try
    Properties properties = new Properties();
    properties.put("user", "sa");
    properties.put("password", "");
    Driver d = (Driver)Class.forName("weblogic.jdbc.mssqlserver4.Driver").newInstance();
    connection = d.connect("jdbc:weblogic:mssqlserver4:JOE:1433",
    properties);
    // or get connection from DataSource...
    Statement statement = connection.createStatement();
    try {
    statement.execute("drop procedure bla");
    } catch (Exception e){}
    statement.execute("create procedure bla as select 'Hello
    ' select 'world'");
    CallableStatement c = connection.prepareCall("{ call bla()
    c.execute();
    ResultSet resultset = c.getResultSet();
    while(resultset.next())
    System.out.println("we got " + resultset.getString(1));
    resultset.close();
    c.getMoreResults();
    resultset = c.getResultSet();
    while(resultset.next())
    System.out.println("we got " + resultset.getString(1));
    resultset.close();
    catch(SQLException exception1)
    exception1.printStackTrace();
    finally
    try { connection.close();} catch(Exception ex) {}
    However, the same code works correctly when run in a simple main()procedure
    from the DOS command line, connecting directly to the database
    using
    only
    the classes supplied with the JDriver product. The resultset classused in this
    case
    is weblogic.jdbc.mssqlserver4.TdsResultSet.
    The stored procedure is very simple, it just has two lines: SELECT
    'Hello'
    and SELECT 'World'. The Java code follows.
    // ... code to get the connection ...
    CallableStatement callableStatement = connection.prepareCall("{CALLspTest}");
    callableStatement.execute();
    ResultSet resultSet = callableStatement.getResultSet();
    if ((resultSet != null) && resultSet.next())
    System.out.println("Row from first result set:" + resultSet.getString(1));
    callableStatement.getMoreResults();
    resultSet = callableStatement.getResultSet();
    if ((resultSet != null) && resultSet.next()) // this call to next()throws the
    exception
    System.out.println("Row from second result set:" + resultSet.getString(1));
    resultSet.close();
    callableStatement.close();
    connection.close();
    I am running WL5.10sp11 with mssqlserver4v70sp11 on NT4.0sp6a and
    JDK1.3.0_02
    (HotSpot Client VM).
    Regards,
    Tom B.--
    B.E.A. is now hiring! (12/14/01) If interested send a resume to [email protected]
    DIRECTOR OF PRODUCT PLANS AND STRATEGY San Francisco,
    CA
    E-SALES BUSINESS DEVELOPMENT REPRESENTATIVE Dallas, TX
    SOFTWARE ENGINEER (DBA) Liberty Corner,
    NJ
    SENIOR WEB DEVELOPER San Jose,CA
    SOFTWARE ENGINEER (ALL LEVELS), CARY, NORTHCAROLINA
    San Jose, CA
    SR. PRODUCT MANAGER Bellevue,WA
    SR. WEB DESIGNER San Jose,CA
    Channel Marketing Manager - EMEA Region London, GBR
    DIRECTOR OF MARKETING STRATEGY, APPLICATION SERVERS San Jose,CA
    SENIOR SOFTWARE ENGINEER (PLATFORM) San Jose,CA
    E-COMMERCE INTEGRATION ARCHITECT San Jose,CA
    QUALITY ASSURANCE ENGINEER Redmond, WA
    Services Development Manager (Business Development Manager - Services)
    Paris, FRA; Munich, DEU
    SENIOR SOFTWARE ENGINEER (PLATFORM) Redmond, WA
    E-Marketing Programs Specialist EMEA London, GBR
    BUSINESS DEVELOPMENT DIRECTOR - E COMMERCE INTEGRATION San Jose,CA
    MANAGER, E-SALES Plano, TX--
    B.E.A. is now hiring! (12/14/01) If interested send a resume to [email protected]
    DIRECTOR OF PRODUCT PLANS AND STRATEGY San Francisco,
    CA
    E-SALES BUSINESS DEVELOPMENT REPRESENTATIVE Dallas, TX
    SOFTWARE ENGINEER (DBA) Liberty Corner,
    NJ
    SENIOR WEB DEVELOPER San Jose, CA
    SOFTWARE ENGINEER (ALL LEVELS), CARY, NORTH CAROLINA
    San Jose, CA
    SR. PRODUCT MANAGER Bellevue, WA
    SR. WEB DESIGNER San Jose, CA
    Channel Marketing Manager - EMEA Region London, GBR
    DIRECTOR OF MARKETING STRATEGY, APPLICATION SERVERS San Jose, CA
    SENIOR SOFTWARE ENGINEER (PLATFORM) San Jose, CA
    E-COMMERCE INTEGRATION ARCHITECT San Jose, CA
    QUALITY ASSURANCE ENGINEER Redmond, WA
    Services Development Manager (Business Development Manager - Services)
    Paris, FRA; Munich, DEU
    SENIOR SOFTWARE ENGINEER (PLATFORM) Redmond, WA
    E-Marketing Programs Specialist EMEA London, GBR
    BUSINESS DEVELOPMENT DIRECTOR - E COMMERCE INTEGRATION San Jose, CA
    MANAGER, E-SALES Plano, TX
    B.E.A. is now hiring! (12/14/01) If interested send a resume to [email protected]
    DIRECTOR OF PRODUCT PLANS AND STRATEGY San Francisco, CA
    E-SALES BUSINESS DEVELOPMENT REPRESENTATIVE Dallas, TX
    SOFTWARE ENGINEER (DBA) Liberty Corner, NJ
    SENIOR WEB DEVELOPER San Jose, CA
    SOFTWARE ENGINEER (ALL LEVELS), CARY, NORTH CAROLINA San Jose, CA
    SR. PRODUCT MANAGER Bellevue, WA
    SR. WEB DESIGNER San Jose, CA
    Channel Marketing Manager - EMEA Region London, GBR
    DIRECTOR OF MARKETING STRATEGY, APPLICATION SERVERS San Jose, CA
    SENIOR SOFTWARE ENGINEER (PLATFORM) San Jose, CA
    E-COMMERCE INTEGRATION ARCHITECT San Jose, CA
    QUALITY ASSURANCE ENGINEER Redmond, WA
    Services Development Manager (Business Development Manager - Services) Paris, FRA; Munich, DEU
    SENIOR SOFTWARE ENGINEER (PLATFORM) Redmond, WA
    E-Marketing Programs Specialist EMEA London, GBR
    BUSINESS DEVELOPMENT DIRECTOR - E COMMERCE INTEGRATION San Jose, CA
    MANAGER, E-SALES Plano, TX

  • JDBC:ODBC, Resultset with 0 rows throws SqlException

    For short, I have used forte for java version 3.0 ea to create an application which is manipulating data in an MS SQLServer database. Further I have installed JDK 1.3.1 and JRE 1.3.1, running on WINDOWS 2000 os.
    The DB-configuring is set to binary sort order.
    When my program is running a "rs = stmt.executQuery() then the situation is:
    1) If this query results in 1 or more rows in the resultset, everything seems to work fine.
    2) But if the resultset doesn't contains any rows, which is a quit legal result and actually a succes criteria in a certain point in my prg., an SQLException is thrown stating "Invalid object name + 'database tablename in uppercase'". Although the db-tables name is in mixedletters (see the code below).
    For testing purpose I have worked out a quit simpel prg. which reflects the real prg. I enclose it for examining purpose.
    I certaintly hope somebody is able to guide me to a solution.
    Thanks in advance.
    Kind regards
    Kuno Reck
    IBC Systems A/S
    TestCode:
    import java.sql.*;
    import javax.swing.*;
    //import javax.swing.table.*;
    class DBTest {
    private static final String driver = "sun.jdbc.odbc.JdbcOdbcDriver",
    dbUrl = "jdbc:odbc:KEKVRF",
    comUser = "tbs", password = "tbs";
    private static Connection conn;
    private static Statement stmt;
    private static ResultSet rs;
    // String queryDdi = "SELECT DISTINCT N.DdiNumber FROM DdiNumbers N left
    join DdiGroups G on N.DdiNumber = G.DdiNumber and N.ProviderId = G.ProviderId
    WHERE 1 = 1 AND N.DdiNumber BETWEEN 35248305 AND 35248309 ORDER BY N.DdiNumber";
    // String queryDdi = "SELECT DISTINCT N.DdiNumber FROM DdiNumbers N left
    join DdiGroups G on N.DdiNumber = G.DdiNumber and N.ProviderId = G.ProviderId
    WHERE 1 = 1 AND N.DdiNumber = 35248307 ORDER BY N.DdiNumber";
    String queryDdi = "SELECT DdiNumber FROM DdiNumbers WHERE DdiNumber =
    35548307";
    public static void main (String[] args){
    DBTest dbtest = new DBTest();
    public DBTest() {
    try{
    Class.forName(driver);
    conn = DriverManager.getConnection(dbUrl, comUser, password);
    java.sql.DriverManager.setLogStream(java.lang.System.out);
    stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_READ_ONLY);
    rs = stmt.executeQuery(queryDdi);
    if (rs.isBeforeFirst()){
    while (rs.next()) {
    // BEM?RK! KolonneV?rdierne skal l?ses ud i samme r?kkef?lge som de
    selectes i sql-statementet.
    System.out.println("DdiNumber = "+rs.getString("DdiNumber"));
    else{
    JOptionPane.showMessageDialog(null, "> Ddi-number does not exist
    < ", "Validation of input fields", JOptionPane.ERROR_MESSAGE);
    catch (SQLException e){
    JOptionPane.showMessageDialog(null, "No matching records found, " +
    e.getMessage(), "SQLException", JOptionPane.ERROR_MESSAGE);
    System.exit(0);
    catch (ClassNotFoundException cnfe){
    JOptionPane.showMessageDialog(null, "ClassNotFoundException, " +
    cnfe.getMessage(), "ClassNotFoundException", JOptionPane.ERROR_MESSAGE);
    LogStream:
    C:\jdk1.3.1\bin>java DBTest
    *Connection.createStatement
    Allocating Statement Handle (SQLAllocStmt), hDbc=148181752
    hStmt=148185176
    Setting statement option (SQLSetStmtOption), hStmt=148185176, fOption=6,
    vParam=3
    Setting statement option (SQLSetStmtOption), hStmt=148185176, fOption=7,
    vParam=1
    Registering Statement sun.jdbc.odbc.JdbcOdbcStatement@17d257
    *Statement.executeQuery (SELECT DdiNumber FROM DdiNumbers WHERE DdiNumber =
    3554830
    7)
    *Statement.execute (SELECT DdiNumber FROM DdiNumbers WHERE DdiNumber = 35548307)
    Free statement (SQLFreeStmt), hStmt=148185176, fOption=0
    Executing (SQLExecDirect), hStmt=148185176, szSqlStr=SELECT DdiNumber FROM
    DdiNumbe
    rs WHERE DdiNumber = 35548307
    Number of result columns (SQLNumResultCols), hStmt=148185176
    value=1
    Get statement option (SQLGetStmtOption), hStmt=148185176, fOption=6
    value=3
    SQLWarning: reason(Result set type has been changed.)
    Number of result columns (SQLNumResultCols), hStmt=148185176
    value=1
    Number of affected rows (SQLRowCount), hStmt=148185176
    value=0
    Fetching (SQLFetchScroll), hStmt=148185176
    End of result set (SQL_NO_DATA)
    Get statement option (SQLGetStmtOption), hStmt=148185176, fOption=14
    RETCODE = -1
    ERROR - Generating SQLException...
    SQLException: SQLState(24000) vendor code(0)
    java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6031)
    at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6188)
    at sun.jdbc.odbc.JdbcOdbc.SQLGetStmtOption(JdbcOdbc.java:3773)
    at sun.jdbc.odbc.JdbcOdbcResultSet.calculateRowCount
    (JdbcOdbcResultSet.java
    :5982)
    at sun.jdbc.odbc.JdbcOdbcResultSet.initialize
    (JdbcOdbcResultSet.java:150)
    at sun.jdbc.odbc.JdbcOdbcStatement.getResultSet
    (JdbcOdbcStatement.java:420)
    at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery
    (JdbcOdbcStatement.java:250)
    at DBTest.<init>(DBTest.java:27)
    at DBTest.main(DBTest.java:18)
    Fetching (SQLFetchScroll), hStmt=148185176
    End of result set (SQL_NO_DATA)
    *Connection.createStatement
    Allocating Statement Handle (SQLAllocStmt), hDbc=148181752
    hStmt=148186208
    Setting statement option (SQLSetStmtOption), hStmt=148186208, fOption=6,
    vParam=0
    Setting statement option (SQLSetStmtOption), hStmt=148186208, fOption=7,
    vParam=1
    Registering Statement sun.jdbc.odbc.JdbcOdbcStatement@19c082
    *Statement.executeQuery (SELECT COUNT(*) FROM DDINUMBERS WHERE DDINUMBER =
    3554830
    7)
    *Statement.execute (SELECT COUNT(*) FROM DDINUMBERS WHERE DDINUMBER = 35548307)
    Free statement (SQLFreeStmt), hStmt=148186208, fOption=0
    Executing (SQLExecDirect), hStmt=148186208, szSqlStr=SELECT COUNT(*) FROM
    DDINUMBE
    RS WHERE DDINUMBER = 35548307
    RETCODE = -1
    ERROR - Generating SQLException...
    SQLException: SQLState(S0002) vendor code(208)
    java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid
    objec
    t name 'DDINUMBERS'.
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6031)
    at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6188)
    at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:2494)
    at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:334)
    at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery
    (JdbcOdbcStatement.java:249)
    at sun.jdbc.odbc.JdbcOdbcResultSet.calculateRowCount
    (JdbcOdbcResultSet.java
    :6063)
    at sun.jdbc.odbc.JdbcOdbcResultSet.initialize
    (JdbcOdbcResultSet.java:150)
    at sun.jdbc.odbc.JdbcOdbcStatement.getResultSet
    (JdbcOdbcStatement.java:420)
    at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery
    (JdbcOdbcStatement.java:250)
    at DBTest.<init>(DBTest.java:27)
    at DBTest.main(DBTest.java:18)
    ResultSet.finalize sun.jdbc.odbc.JdbcOdbcResultSet@4ac268
    ResultSet.finalize sun.jdbc.odbc.JdbcOdbcResultSet@216869
    *ResultSet.close
    C:\jdk1.3.1\bin>

    Hi,
    my suggestion: you can't use isBeforeFirst() on empty result set. Try following:
    rs = stmt.executeQuery(queryDdi);
    int count = 0;
    while (rs.next()) {
      count++;
      System.out.println("DdiNumber = "+rs.getString("DdiNumber"));
    if (count == 0) {
    JOptionPane.showMessageDialog(null, "> Ddi-number does not exist < ", "Validation of input fields", JOptionPane.ERROR_MESSAGE);
    }Best Regards,
    Martin

  • ResultSet - RowSet - RecordSet

    Hi there,
    I'm a newbie to Flash Remoting. I'm having difficulty
    transferring a result set to flash using an intermittent rowset,
    can anyone help?
    The result to flash is null with either of the
    implementations (commented & uncommented).
    import java.sql.*;
    import javax.sql.rowset.CachedRowSet;
    import com.sun.rowset.CachedRowSetImpl;
    public class JavaClassService {
    public ResultSet getResultSet(){
    Connection connection = null;
    try{
    Class.forName( "com.mysql.jdbc.Driver" );
    connection = DriverManager.getConnection(
    "jdbc:mysql://localhost/test", "root", "space7107");
    Statement stmt = connection.createStatement();
    ResultSet resultset = stmt.executeQuery("SELECT * FROM
    testdata");
    CachedRowSet crs = new CachedRowSetImpl();
    //crs.setUsername("root");
    //crs.setPassword("space7107");
    //crs.setUrl("jdbc:mysql://localhost/test");
    //crs.setCommand("SELECT * FROM testdata");
    //crs.execute();
    crs.populate(resultset);
    resultset.close();
    stmt.close();
    connection.close();
    return crs;
    }catch(Exception e){
    }finally{
    try{
    if(connection!= null && !connection.isClosed())
    connection.close();
    }catch(SQLException e){}
    return null;

    In case anyone has this problem - Sun 1.5 is required to use
    CachedRowset - I had been trying to use 1.4 and the rowset.jar,
    which wasn't working. Both commented&uncommented java code work
    fine with flash remoting.

  • Question about context.close in 6.0

    Hi,
    In the document of WebLogic 6.0 JNDI mention that client should close the
    context in order to release resources.
    This is not required at 5.1.
    So my question is if one does not do close the context what will happened ?
    will run of resource eventually ?
    Also when should one close the Context ?
    If the context close prematurely, does the object reference obtained from
    the context no longer valid ?
    It is kind of interesting that the JNDI context implemented in this way !
    Thanks for any answer in advance.
    Evan

    Hi Chris,
    Thanks for your reply.
    What would be the "default" access right for user
    "all" (i.e. all authenticated users)? Only "write" &
    "delete" ?
    No, it's equivalent to (read, list, execute, info,
    write, delete).
    Is it (read, list, execute,info) of user "anyone" + allow (write, delete) for user "all" = (read, list, execute, info, write, delete) for user "all"?
    Then what will be the access right of user "all" if I remove the line 'allow (write, delete) user = "all";'? Only the access right (read, list, execute,info) or even no access right at all?
    Thanks and regards,
    David

  • ResultSet.next() throws NullPointerException

    Hello,
    When running the following code:
    import java.sql.*;
    class DatabaseDriver {
         private int                    databaseType;
         private String               error;
         private Connection     con;
         private Statement          statement;
         private ResultSet          rs;
         static final int          MYSQL_DB_TYPE = 1;
         static final int          PGSQL_DB_TYPE = 2;
         static final int          MSSQL_DB_TYPE = 3;
         static final int          ORACLE_DB_TYPE = 4;
         public DatabaseDriver (int dbType) {
              databaseType = dbType;
              try {
                   switch (dbType) {
                        case MYSQL_DB_TYPE:
                             Class.forName("com.mysql.jdbc.Driver").newInstance();
                             break;
                        case PGSQL_DB_TYPE:
                             Class.forName("org.postgresql.Driver").newInstance();
                             break;
                        case MSSQL_DB_TYPE:
                             Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();
                             break;
                        case ORACLE_DB_TYPE:
                             Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
                             break;
              } catch (Exception e) {
                   error = "could not load driver";
         public boolean connect (String server, String user, String password) {
              try {
                   con = DriverManager.getConnection("jdbc:mysql://" + server + "?user=" + user + "&password=" + password);
              } catch (Exception e) {
                   error = "could not connect to the database";
                   return false;
              return true;
         public boolean execQuery (String query) {
              try {
                   statement = con.createStatement();
                   if (statement.execute(query)) {
                        rs = statement.getResultSet();
                   while (rs.next()) {
                        System.out.println(rs.getString("1") + "\t" + rs.getString("2"));
                   rs.close();
                   rs = null;
                   statement.close();
                   statement = null;
              } catch (Exception e) {
                   error = e.toString();
                   e.printStackTrace();
                   return false;
              return true;
         public String getError () {
              return error;
         public boolean disconnect () {
              return true;
    class Test {
         public static void main (String[] args) {
              DatabaseDriver db = new DatabaseDriver(1);
              db.connect(args[0],args[1],args[2]);
              db.execQuery("USE " + args[3] + ";");
              db.execQuery("SELECT * FROM te;");
              System.out.println(db.getError());
    }I receive this in the printout:
    java.lang.NullPointerException
         at DatabaseDriver.execQuery(DatabaseDriver.java:61)
         at Test.main(Test.java:7)
    bla1     bla2
    bla6     bla7
    java.lang.NullPointerException
    Line 61
    while (rs.next()) {
    I have read a lot of other posts that say that the connection object is null or the recordset is empty, but it seems that neither of those are the case considering I am able to printout the two rows properly.
    Can someone please explain to me what I am doing wrong and how to fix it?
    Thanks

    You can pepper your code with System.out.println() statements to determine what value goes into the execute() statement before it runs.
    In the following, I think the first statement will probably return false. What is this sql trying to accomplish that you think it sould return true? Even if it returned true, what value do you expect in the resultSet?
    db.execQuery("USE " + args[3] + ";");
    db.execQuery("SELECT * FROM te;");
    As a side note, I strongly suggest you use connection pooling and not driverManager. here is an example of getting and returning a connection properly (all within a function)
    public String[] myFunction(){
    Connection conn=null;
    PreparedStatement pstmt1= null;
    ResultSet resultSet=null;
    ArrayList list1; //array that can grow in size
    try{
    list1=new ArrayList();
    conn= dataSource.getConnection();
    pstmt1= conn.prepareStatement();
    resultSet= pstmt1.executeUpdate();
    while(resultSet.next()){
    arrayList.add(resultSet.getString("lastName");
    return ( String[] ) arrayList.toArray( new String[arrayList.size()] );
    } catch (SqlException e){
    e.printStackTrace();
    } finally {
    if(rsultSet!=null)
    resultSet.close();
    if(pstmt1!=null)
    pstmt1.close();
    if(conn!=null)
    conn.close();
    }

Maybe you are looking for

  • Software update taking too long!

    Hi, I recently got myself a Macbook Pro 13" newer version (late 2011 model) running Mac OS X Lion. Today I got a system update notification for safari, and it asked me to restart the Macbook for system update. Its been 15 minutes since that update is

  • Printing from CS5 using mountain lion on imac

    I have downloaded mountain lion upgrade from originally using snow leopard for my imac and now CS5 does not print. However Photoshop elements 9 is OK. All other document print OK. Is this an Apple problem or Adobe problem?

  • Works in Itunes, not ATV

    I've been using Handbrake to encode some home movies from VOB files to MP4. I've tried several settings that work in Itunes but the ATV won't recognize them. Has anyone else seen this? I am using the Windows GUI version.

  • Share Function using Matrox MX02mini with FAST

    Using MX02 mini with Fast and v1.8 drivers on MacPro 2.66GHz Quad, 7GB RAM having the latest versions of FCP and Snow Leopard plus all updates as at 1st November. Unable to export using the Share function although can export using QT conversion. When

  • How to access pdf documents in the cloud from an iOS device?

    Once a PDF document is saved in icloud, how do I access it from the iPad or the iPhone? Which app is required?