ResultSet (JDBC)

hallo,
I want to execute an sql statement
**** AdIdArray ist eine int Array ***
ResultSet [] AResultSet=new ResultSet[5];
String query="select AdName from AdInformation where AdId in(?)";
PreparedStatement pre=Con.prepareStatement(query);
for(int x=0; x<= AdIdArray.length -1; x++){
pre.setInt(1,AdIdArray[x]);
AResultSet[x]=pre.executeQuery();
System.err.println("Name : "+AResultSet[x].getString("AdName"));
ich bevomm folowing SQL Exception
java.sql.SQLException: JZ0R1: Result set is IDLE as you are not currently accessing a row.
which I do wrongly ???
thanks

hallo,
I want to execute an sql statement
**** AdIdArray ist eine int Array ***
DONT NEED
ResultSet [] AResultSet=new ResultSet[5]; >
String query="select AdName from AdInformation where
AdId in(?)";
ps.setInt(1,SOME_ID);
PreparedStatement pre=Con.prepareStatement(query);
for(int x=0; x<= AdIdArray.length -1; x++){
pre.setInt(1,AdIdArray[x]);
ResultSet rs=pre.executeQuery();
String name="";
if(rs.next()){
name = rs.getString("AdName"))
ich bevomm folowing SQL Exception
java.sql.SQLException: JZ0R1: Result set is IDLE as
you are not currently accessing a row.
which I do wrongly ???
thanks

Similar Messages

  • Oracle.jdbc.driver.oracleResultSet Vs java.sql.ResultSet

    Hi all
    Could any one got any idea on this problem...
    My application program is forced to use both Java Result Set(java.sql.ResultSet) and Oracle ResultSet(jdbc.driver.oracleResultSet).
    This on javac get compiled and is working fine....
    But when i try to compile with vbjc(visibroker-java compiler)... it failes to compile...
    throwing ...
    .."The method oracle.jdbc2.Blob getBlob(int) declared in class oracle.jdbc.driver.OracleResultSet cannot override the method of the same signature declared in interface java.sql.ResultSet. They must have the same return
    type."

    Hi Prowzen,
    Ur reply was much userful, which gave me a direction to prob into... Thank You Very MUCH.
    I relpaced
    BLOB blob = ((OracleResultSet)rs).getBLOB(int);
    with
    oracle.sql.BLOB blob =(BLOB)rs.getObject(int);
    So eliminating usage of OracleResultSet, the conflicts got cleared...
    Keep writing...
    Regards
    Sreekumar P P.
    [email protected]

  • Loading data one page at a time

    I have 200 records to load in a java server page. I felt loading all these records will affect performance. So I wanted to load 15 records on each pass. However, on the second pass I obtained a nullpointerException(ResultSet -JDBC). Any suggestion on how to do it?
    my other option is to dump them in a vector and retrieve them from there. I really want to use my database connection.
    Thanks

    Remember after the 15th record, I need to bring the record pointer on the 16th one so I can continue to read the next record in the Resulset. Closing the connection, and reissuing the same scheme will take you back to the first record.
    Thanks

  • Using a for-each for a CallObject

    Hello everyone,
    i am having trouble to get the following scenario to work:
    1. SQL Call is prepared and called
    2. Branch with a condition whether there is a payment related to an invoice
    3. For-Each record of the resultset a cancellation will be called by using a B1Objectcall with cancellation method
    The for-each is configurated like this:
    /vpf:Msg/vpf:Body/vpf:Payload[@Role='C']/jdbc:ResultSet/jdbc:Row
    The path is configurated like this:
    /vpf:Msg/vpf:Body/vpf:Payload[./@id=&apos;atom36&apos;]/jdbc:ResultSet[./@rowCount>&apos;0&apos;]
    My problem is the preparation of the xsl-transformation to access the DocEntry of each record. This is my xml.
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:b1e="urn:com.sap.b1i.sim:b1event" xmlns:b1ie="urn:com.sap.b1i.sim:b1ievent" xmlns:b1im="urn:com.sap.b1i.sim:b1imessage" xmlns:bfa="urn:com.sap.b1i.bizprocessor:bizatoms" xmlns:jdbc="urn:com.sap.b1i.adapter:jdbcadapter" xmlns:rfc="urn:sap-com:document:sap:rfc:functions" xmlns:sim="urn:com.sap.b1i.sim:entity" xmlns:utils2="com.sap.b1i.bpc_tools.Utilities" xmlns:vpf="urn:com.sap.b1i.vplatform:entity" xmlns:xci="urn:com.sap.b1i.xcellerator:intdoc" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" bfa:force="" vpf:force="" jdbc:force="" rfc:force="" b1ie:force="" b1e:force="" xci:force="" sim:force="" utils2:force="" b1im:force="">
      <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
      <xsl:param name="atom"/>
      <xsl:param name="sessionid"/>
      <xsl:variable name="msg" select="/vpf:Msg/vpf:Body/vpf:Payload[./@Role=&apos;S&apos;]"/>
      <xsl:variable name="msg2" select="/vpf:Msg/vpf:Body/vpf:Payload[@Role='C']/jdbc:ResultSet/jdbc:Row"/>
      <xsl:variable name="vpSender" select="/vpf:Msg/vpf:Header/vpf:Sender/@Id"/>
      <xsl:variable name="vpObject" select="/vpf:Msg/vpf:Header/vpf:Sender/@ObjId"/>
      <xsl:variable name="vpReceiver" select="/vpf:Msg/vpf:Header/vpf:ReceiverList/vpf:Receiver[./@handover=&apos;P&apos;]/@Id"/>
      <xsl:variable name="vpSysId" select="/vpf:Msg/vpf:Header/vpf:Variables/vpf:var[./@id=&apos;SysId&apos;]/@value"/>
      <xsl:template match="/">
      <Msg xmlns="urn:com.sap.b1i.vplatform:entity">
      <xsl:copy-of select="/vpf:Msg/@*"/>
      <xsl:copy-of select="/vpf:Msg/vpf:Header"/>
      <Body>
      <xsl:copy-of select="/vpf:Msg/vpf:Body/*"/>
      <Payload Role="X" id="{$atom}">
      <xsl:call-template name="transform"/>
      </Payload>
      </Body>
      </Msg>
      </xsl:template>
      <xsl:template name="transform">
      <Value xmlns="">
      <xsl:value-of select="$msg2/DocEntry"/>
      </Value>
      </xsl:template>
    </xsl:stylesheet>
    This is the inbound message on the path:
    <Msg xmlns="urn:com.sap.b1i.vplatform:entity" MessageId="14123112452456040534C0A800138613" BeginTimeStamp="20141231124524" logmsg="0000" SubMessageId="" status="success" owntst="false" test="true">
      <Header>
      <IPO Id="INB_IQ_INTQ_ASYN_QS" tid="14123109281856033321C0A80013BACE" />
      <IPO Id="PRC_QS" tid="14123109281856033506C0A8001381B0" />
      <msglog step="Default message log" always="false" b1ifactive="true" />
      <Resumption>
      <starter ipo="/vP.0010000000.in_IQ/com.sap.b1i.vplatform.runtime/INB_IQ_INTQ_ASYN_QS/INB_IQ_INTQ_ASYN_QS.ipo/proc" />
      <restart id="processing" q="Q.PRC_QS.0010000000" s="S.sap.DRFISQueuertFIS" u="14123112231756033345C0A800139613.4" />
      </Resumption>
      <ProcStream>S.sap.DRFISQueuertFIS</ProcStream>
      <Sender Id="0010000000" ObjId="sap.DetailReportFIS" />
      <Successor Id="" Mode="" />
      <Identification Ident="Queue/Stream" IdPar="n.a." />
      <nsList>
      <ns id="b1mb" ns="http://tempuri.org/" />
      </nsList>
      <ReceiverList>
      <Receiver Id="0010000000" filter="" />
      </ReceiverList>
      <Retrieval type="Handover" />
      <Outbound type="Void" channel="VOID" />
      <vBIU Id="sap.DRFISQueue" ver="1.0.0" SId="sap.Files" filter="" phase="" />
      <Variables>
      <var id="userid" value="no_authentication" />
      <var id="username" value="no_authentication" />
      <var id="SysId" value="0010000117" />
      </Variables>
      <Properties />
      <SysTypeProperties type="B1if" offline="" snd="0010000000" rcv="receiverdummy" ssystype="B1i.20" rsystype="" />
      <LocalProperties type="B1if" biu="sap.DRFISQueue" snd="0010000000" rcv="receiverdummy" sid="sap.Files" offline="" />
      <VarProperties>
      <property call="callb1obj.bfd" atom="atom3" id="SysId" value="#0010000117" />
      <property call="callsql.bfd" atom="atom36" id="SysId" value="#0010000117" />
      </VarProperties>
      </Header>
      <Body>
      <Payload Role="T" Type="Queue" add="sap.DetailReportFIS" />
      <Payload Role="S">
      <Document xmlns="">
      <row>
      <BuchungsID>47662</BuchungsID>
      <Datum>15.12.2014</Datum>
      <VertragspartnerID>61</VertragspartnerID>
      <Firmenname>Software Integrator</Firmenname>
      <KreditorenID>K123456</KreditorenID>
      <Kreditor>Intrum Justitia AG</Kreditor>
      <ForderungsID>9015</ForderungsID>
      <Rechnungsnummer>121</Rechnungsnummer>
      <Buchungstyp>DEBTCLAIM_REVOKE</Buchungstyp>
      <Buchungstext>Forderungsruecknahme</Buchungstext>
      <Waehrung>CHF</Waehrung>
      <Nettobetrag>-7560.00</Nettobetrag>
      <MwStSatz>0</MwStSatz>
      <MwStBetrag>0</MwStBetrag>
      <Bruttobetrag>-7560.00</Bruttobetrag>
      <Verrechnungsposition>n</Verrechnungsposition>
      </row>
      </Document>
      </Payload>
      <Payload Role="X" id="atom35">
      <row xmlns="">
      <Value>SELECT T0.DocNum FROM ORCT T0 WHERE T0.Canceled ='N' AND T0.DocNum IN (SELECT T1.DocNum FROM ORCT T0 INNER JOIN RCT2 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OINV T2 ON T1.DocEntry = T2.DocNum WHERE T2.DocNum = '121')</Value>
      <Value2>Update OINV set U_sapSTORNF = '1' WHERE DocEntry = '121'</Value2>
      </row>
      </Payload>
      <Payload Role="C" id="atom36" system="0010000117" mode="single" method="Automatic detection by key word(Automatic detection by key word)" plr="4" dbtype="SQL" blockExecution="false" compatibilityMode="true" delimiter=";" sql="SELECT T0.DocNum FROM ORCT T0 WHERE T0.Canceled ='N' AND T0.DocNum IN (SELECT T1.DocNum FROM ORCT T0 INNER JOIN RCT2 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OINV T2 ON T1.DocEntry = T2.DocNum WHERE T2.DocNum = '121')" disable-output-escaping="false">
      <ResultSet xmlns="urn:com.sap.b1i.adapter:jdbcadapter" rowCount="1">
      <Row>
      <DocNum>163</DocNum>
      </Row>
      </ResultSet>
      </Payload>
      <Payload Role="C" id="atom48" status="ok" input="atom35" queue="Q.INB_IQ_INTQ_ASYN_QS.0010000000" stream="sap.DRFISQueue3" />
      <Payload Role="X" id="atom33">
      <row xmlns="">
      <Value>163</Value>
      </row>
      </Payload>
      </Body>
    </Msg>

    Hello everyone,
    THis is how my stuff looks now:
    i have tried the above named solutions but i think, that as soon as i am checking the inbound parameter of the for-each it says something like that:
    - <ResultSet xmlns="urn:com.sap.b1i.adapter:jdbcadapter" rowCount="1"> 
    - <Row> 
    <DocNum>163</DocNum>  
    </Row>
    </ResultSet>
    While in the path i have got a such inbound parameter:
    the code just shows the sql call and the X Role of atom33 where i am using the personal tag
    - <Payload Role="C" id="atom36" system="0010000117" mode="single" method="Automatic detection by key word(Automatic detection by key word)" plr="4" dbtype="SQL" blockExecution="false" compatibilityMode="true" delimiter=";" sql="SELECT T0.DocNum FROM ORCT T0 WHERE T0.Canceled ='N' AND T0.DocNum IN (SELECT T1.DocNum FROM ORCT T0 INNER JOIN RCT2 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OINV T2 ON T1.DocEntry = T2.DocNum WHERE T2.DocNum = '121')" disable-output-escaping="false"> 
    - <ResultSet xmlns="urn:com.sap.b1i.adapter:jdbcadapter" rowCount="1"> 
    - <Row> 
    <DocNum>163</DocNum>  
    </Row>
    </ResultSet>
    </Payload>
    <Payload Role="C" id="atom48" status="ok" input="atom35" queue="Q.INB_IQ_INTQ_ASYN_QS.0010000000" stream="sap.DRFISQueue3" />  
    - <Payload Role="X" id="atom33"> 
    <DocId xmlns="">163</DocId>  
    </Payload>
      </Body>
    This is my call object configuration
    This message is the Key Value:
    /vpf:Msg/vpf:Body/vpf:Payload[./@Role='X' and ./@id='atom33']/DocId
    This is my atom33:
    <xsl:for-each select="/vpf:Msg/vpf:Body/vpf:Payload[./@Role=&apos;C&apos; and ./@id=&apos;atom36&apos;]/jdbc:ResultSet/jdbc:Row">
    <DocId xmlns="">
    <xsl:value-of select="jdbc:DocNum"/>
    </DocId>
    </xsl:for-each>
    When checking the message of the join inbound it shows the following:
    So it seems that at some point i am completely losing some inbound message (such as the atom33).
    - <Msg xmlns="urn:com.sap.b1i.vplatform:entity"> 
    - <Body> 
    - <Payload Role="X" id="atom56"> 
    <DocId2 xmlns="" />  
    </Payload>
    - <Payload Role="C" id="atom55" system="0010000117"> 
    <B1CallResult status="failure" b1login="Technical User" method="Synchronous Cancel" objectid="24" payload="atom56" keyname="DocEntry" keyvalue="" />  
    </Payload>
    </Body>
    </Msg>
    This is the atom56 config, which is just a tryout. Or do I use a wrong payload in my call object?
    Help is greatly appreciated.
    Regards Simon

  • Question on Using Persistence Object

    Hi,
    I want to store a hashtable of persistent info with about five attributes (id, name, username, date) in order to not always call the database. I am either going to use session or request objects.
    My question is if it's a good idea to store the hashtable with 2000 records just to avoid the database connection or should I just stick with using database connection using connection pooling? Thanks.
    Mkie

    How long you are going to store it ????
    1. If it is for a long time then this is not a good strategy as:
    a) Database data can change (in that case you will have wrong data)
    b) Your heap memory will be unnecessarily loaded.
    2. If it is for a very short time then it again carries no meaning as creating the object will have a significant overhead.
    3) If it is something between these two. You need to have a thorough analysis to see which would be best. However in my humble opinion a scrollable resultset(JDBC 2.0) will still be better.
    Shubhrajit

  • Some problems about entity bean

    As what I learnt from books, client uses primary key for getting instance of entity bean. However, if I want to create some entity beans for read only purposes. That is, I will not has the process of bean instantiation from client side directly. What should that object be existed in my system. As they are persistent, they will not be value object. Would you give me some suggestions?

    If you want to create some entity-bean instances in order to read the data from the database, you should you find method insteads of create method. If you want to ADD new row in the table then use create method.
    If you want to read, it is better to used session bean, and get the RowSet from ResultSet(jdbc)(Please don't update the data in RowSet it will update the database but the entity bean when you do it).
    I hope I understand your question correctly and you understand what my words too.

  • How to handle large result sets?

    Hi All,
    I have a large result set to be displayed to user using jsp's. Problem is that result set is too big, so I can't display all the records in a single push. I want to show the results page by page say 25 per page. Now for every page I have to fetch data from database, means there are going to be many database calls which is not advisable. Or i can cache data in a CachedRowSet to reduce database calls, but in this case you have to store all the data in memory which is not a good solution in case you have very large data sets. Can anybody suggest me a solution to this problem?

    The best thing for you to do is to implmeneting paging logic in conjunction with a scrollable resultset (JDBC 2.0+).
    The logic would go like this assuming 30 rows per page:
    - keep track of which page the user is on (e.g. page 3)
    - issue the full sql
    - scroll thru only the rows in the current page (e.g. rows 90-120)
    - copy the page's rows to value objects
    - close the resultset, statement, and connection
    In the above example, you would scroll to row 90 using rs.absolute(90).
    The efficiency comes from the fact that you're using a scrollable resultset. By using this, only the rows that you scroll thru are extracted out from the database. I performed some simple testing and with my data, and the scrollable resultset was about 10x in performance.
    Good luck!

  • Outbound "Mutiple" how does it work?

    Hi,
    how does the outbound "Mutiple" work. Can I use DI Objects and an SQL-call in one "command" ?
    Best regards,
    Manuel Marhold

    Hi Martina,
    If I do so, no xml is passed to R2. I  got following code in atom0:
    <b1im_mulitmsg xmlns="">
         <b1im_msg>
              <xsl:element name="B1out">
                   <xsl:attribute name="type">object</xsl:attribute>
                   <!--<xsl:attribute name="type">object_full</xsl:attribute>
                   <xsl:element name="Control">
                        <xsl:element name="method">Update</xsl:element>
                        <xsl:element name="objectid">4</xsl:element>
                        <xsl:element name="keyname">ItemCode</xsl:element>
                   </xsl:element>
                   <xsl:element name="Payload">-->
                        <xsl:element name="Items">
                             <xsl:element name="row">
                                  <xsl:element name="ItemCode">
                                       <xsl:value-of select="$vpItemCode"></xsl:value-of>
                                  </xsl:element>
                             </xsl:element>
                        </xsl:element>
                        <xsl:element name="Items_Prices">
                             <xsl:call-template name="EmptyPricelists">
                                  <xsl:with-param name="i">1</xsl:with-param>
                                  <xsl:with-param name="count">
                                       <xsl:value-of select="/bfa:unbranch/vpf:Msg/vpf:Body/vpf:Payload[./@id = &apos;atom2&apos;]/jdbc:ResultSet/jdbc:Row/jdbc:LineNum"></xsl:value-of>
                                  </xsl:with-param>
                             </xsl:call-template>
                             <xsl:for-each select="/bfa:unbranch/vpf:Msg/vpf:Body/vpf:Payload[@id=&apos;atom3&apos;]/jdbc:ResultSet/jdbc:Row">
                                  <xsl:element name="row">
                                       <xsl:element name="PriceList">
                                            <xsl:value-of select="jdbc:PriceList"></xsl:value-of>
                                       </xsl:element>
                                       <xsl:element name="Price">
                                            <xsl:value-of select="jdbc:Price"></xsl:value-of>
                                       </xsl:element>
                                  </xsl:element>
                             </xsl:for-each>
                        </xsl:element>
                   </xsl:element>
              <!--</xsl:element>-->
         </b1im_msg>
         <b1im_msg>
              <xsl:element name="B1out">
                   <xsl:attribute name="type">sql</xsl:attribute>
                   <xsl:element name="sql">
                        <xsl:choose>
                             <xsl:when test="/bfa:unbranch/vpf:Msg/vpf:Body/vpf:Payload[./@id=&apos;atom1&apos;]/jdbc:ResultSet/@rowCount &gt; 0">
                                  UPDATE [@SCB_B1I_ITEMPRICESP] SET U_Price = <xsl:value-of select="$msg/BOM/BO/Items_Prices/row[PriceList=$vpPriceListPurchase]/Price"/> WHERE Code = &apos;<xsl:value-of select="/bfa:unbranch/vpf:Msg/vpf:Body/vpf:Payload[./@id=&apos;atom1&apos;]/jdbc:ResultSet/jdbc:Row/jdbc:Code"/>&apos;
                             </xsl:when>
                             <xsl:otherwise>
                                  INSERT INTO [@SCB_B1I_ITEMPRICESP] VALUES ((SELECT REPLICATE(&apos;0&apos;, 8 - LEN((SELECT MAX(CAST(Code AS int)) + 1 FROM [@SCB_B1I_ITEMPRICESP]))) + (SELECT CAST(MAX(CAST(Code AS int)) + 1 AS nvarchar(8)) FROM [@SCB_B1I_ITEMPRICESP])), &apos;<xsl:value-of select="$vpItemCode"/>&apos;, <xsl:value-of select="$msg/BOM/BO/Items_Prices/row[PriceList=$vpPriceListPurchase]/Price"/>)
                             </xsl:otherwise>
                        </xsl:choose>
                   </xsl:element>
              </xsl:element>
         </b1im_msg>
    </b1im_mulitmsg>
    as you can see, I also tried it with the full object and I also tried it without the second object (sql).
    the result of atom 0 is:
    <Payload Role="R" id="atom0" pltype="xml">
          <b1im_mulitmsg xmlns="">
            <b1im_msg>
              <B1out type="object">
                <Items>
                  <row>
                    <ItemCode>test</ItemCode>
                  </row>
                </Items>
                <Items_Prices>
                  <row>
                    <PriceList>3</PriceList>
                    <Price>435.000000</Price>
                  </row>
                  <row>
                    <PriceList>4</PriceList>
                    <Price>580.000000</Price>
                  </row>
                  <row>
                    <PriceList>5</PriceList>
                    <Price>725.000000</Price>
                  </row>
                  <row>
                    <PriceList>6</PriceList>
                    <Price>870.000000</Price>
                  </row>
                </Items_Prices>
              </B1out>
            </b1im_msg>
            <b1im_msg>
              <B1out type="sql">
                <sql>UPDATE [@SCB_B1I_ITEMPRICESP] SET U_Price = 290.000000 WHERE Code = '00000001'</sql>
              </B1out>
            </b1im_msg>
          </b1im_mulitmsg>
        </Payload>
    The result of R2 is:
    <Payload Role="R2" Call="no"/>
    Errormessage is: B1out or BOM/BO or BS segment missing in receiver payload (handover to B1 not possible)

  • Bin Location In Stock Transfer

    Hi,
    I have to set the bin location for From Whs and To Whs in B1if
    <StockTransfer_Lines>
                            <xsl:for-each select="/vpf:Msg/vpf:Body/vpf:Payload[./@Role=&apos;C&apos; and ./@id=&apos;atom1&apos;]/jdbc:ResultSet/jdbc:Row">
                                <row>       
                                    <ItemCode>
                                        <xsl:value-of select="jdbc:ITEMCODE/text()"></xsl:value-of>
                                    </ItemCode>
                                    <ItemDescription>
                                        <xsl:value-of select="jdbc:DESCRIPTION/text()"></xsl:value-of>
                                    </ItemDescription>
                                    <Quantity>
                                        <xsl:value-of select="jdbc:QUANTITY/text()"></xsl:value-of>
                                    </Quantity>
                                   <WarehouseCode>
                                        <xsl:value-of select="jdbc:TOWHSCODE/text()"></xsl:value-of>
                                    </WarehouseCode>
                                    <FromWarehouseCode>
                                        <xsl:value-of select="jdbc:FILLER/text()"></xsl:value-of>
                                    </FromWarehouseCode>                               
                                    <MeasureUnit>
                                    Kgs
                                    </MeasureUnit>
                                </row>
                            </xsl:for-each>
                        </StockTransfer_Lines>
    This is the XML I generated for adding StockTransfer Line . But I dont have any idea about the Bin Location, How to set it. Please help.
    Thank You.

    Hi
    Here the schema for Stock Transfer:
    <?xml version="1.0" encoding="utf-8" ?>
    <BOM>
      <!-- DB Table Name: OWTR  -->
      <BO>
        <!-- multiple such elements are allowed  -->
        <AdmInfo>
          <Object>long</Object>
          <Version>long</Version>
        </AdmInfo>
        <QueryParams>
          <DocEntry>string (db: DocEntry, Numeric(11))</DocEntry>
        </QueryParams>
        <StockTransfer>
          <row>
            <!-- multiple such elements are allowed  -->
            <Series>long (db: Series, Numeric(6))</Series>
            <Printed>string (db: Printed, Alpha(1))</Printed>
            <DocDate>string (db: DocDate, Date(8))</DocDate>
            <DueDate>string</DueDate>
            <CardCode>string (db: CardCode, Alpha(15))</CardCode>
            <CardName>string (db: CardName, Alpha(100))</CardName>
            <Address>string (db: Address, Alpha(254))</Address>
            <Reference1>string (db: Ref1, Alpha(11))</Reference1>
            <Reference2>string (db: Ref2, Alpha(11))</Reference2>
            <Comments>string (db: Comments, Alpha(254))</Comments>
            <JournalMemo>string (db: JrnlMemo, Alpha(50))</JournalMemo>
            <PriceList>long (db: GroupNum, Numeric(6))</PriceList>
            <SalesPersonCode>long (db: SlpCode, Numeric(6))</SalesPersonCode>
            <FromWarehouse>string (db: Filler, Alpha(8))</FromWarehouse>
            <ToWarehouse>string</ToWarehouse>
            <TaxDate>string (db: TaxDate, Date(8))</TaxDate>
            <ContactPerson>long (db: CntctCode, Numeric(11))</ContactPerson>
            <FolioPrefixString>string (db: FolioPref, Alpha(2))</FolioPrefixString>
            <FolioNumber>long (db: FolioNum, Numeric(11))</FolioNumber>
            <DocObjectCode>string (db: ObjType, Alpha(20))</DocObjectCode>
            <AuthorizationCode>string</AuthorizationCode>
            <StartDeliveryDate>string</StartDeliveryDate>
            <StartDeliveryTime>long</StartDeliveryTime>
            <EndDeliveryDate>string</EndDeliveryDate>
            <EndDeliveryTime>long</EndDeliveryTime>
            <VehiclePlate>string</VehiclePlate>
            <ATDocumentType>string</ATDocumentType>
            <EDocExportFormat>long</EDocExportFormat>
            <ElecCommStatus>string</ElecCommStatus>
          </row>
        </StockTransfer>
        <StockTransfer_ApprovalRequests>
          <row>
            <!-- multiple such elements are allowed  -->
            <Remarks>string</Remarks>
          </row>
        </StockTransfer_ApprovalRequests>
        <StockTransfer_Lines>
          <row>
            <!-- multiple such elements are allowed  -->
            <LineNum>long</LineNum>
            <ItemCode>string</ItemCode>
            <ItemDescription>string</ItemDescription>
            <Quantity>double</Quantity>
            <Price>double</Price>
            <Currency>string</Currency>
            <Rate>double</Rate>
            <DiscountPercent>double</DiscountPercent>
            <VendorNum>string</VendorNum>
            <SerialNumber>string</SerialNumber>
            <WarehouseCode>string</WarehouseCode>
            <FromWarehouseCode>string</FromWarehouseCode>
            <ProjectCode>string</ProjectCode>
            <Factor>double</Factor>
            <Factor2>double</Factor2>
            <Factor3>double</Factor3>
            <Factor4>double</Factor4>
            <DistributionRule>string</DistributionRule>
            <DistributionRule2>string</DistributionRule2>
            <DistributionRule3>string</DistributionRule3>
            <DistributionRule4>string</DistributionRule4>
            <DistributionRule5>string</DistributionRule5>
            <UseBaseUnits>string</UseBaseUnits>
            <MeasureUnit>string</MeasureUnit>
            <UnitsOfMeasurment>double</UnitsOfMeasurment>
            <BaseType>long</BaseType>
            <BaseLine>long</BaseLine>
            <BaseEntry>long</BaseEntry>
            <UnitPrice>double</UnitPrice>
            <UoMEntry>long</UoMEntry>
            <InventoryQuantity>double</InventoryQuantity>
          </row>
        </StockTransfer_Lines>
        <SerialNumbers>
          <row>
            <!-- multiple such elements are allowed  -->
            <ManufacturerSerialNumber>string</ManufacturerSerialNumber>
            <InternalSerialNumber>string</InternalSerialNumber>
            <ExpiryDate>string</ExpiryDate>
            <ManufactureDate>string</ManufactureDate>
            <ReceptionDate>string</ReceptionDate>
            <WarrantyStart>string</WarrantyStart>
            <WarrantyEnd>string</WarrantyEnd>
            <Location>string</Location>
            <Notes>string</Notes>
            <BatchID>string</BatchID>
            <SystemSerialNumber>long</SystemSerialNumber>
            <BaseLineNumber>long</BaseLineNumber>
            <Quantity>double</Quantity>
          </row>
        </SerialNumbers>
        <BatchNumbers>
          <row>
            <!-- multiple such elements are allowed  -->
            <BatchNumber>string</BatchNumber>
            <ManufacturerSerialNumber>string</ManufacturerSerialNumber>
            <InternalSerialNumber>string</InternalSerialNumber>
            <ExpiryDate>string</ExpiryDate>
            <ManufacturingDate>string</ManufacturingDate>
            <AddmisionDate>string</AddmisionDate>
            <Location>string</Location>
            <Notes>string</Notes>
            <Quantity>double</Quantity>
            <BaseLineNumber>long</BaseLineNumber>
          </row>
        </BatchNumbers>
        <StockTransferLinesBinAllocations>
          <row>
            <!-- multiple such elements are allowed  -->
            <BinAbsEntry>long</BinAbsEntry>
            <Quantity>double</Quantity>
            <AllowNegativeQuantity>string</AllowNegativeQuantity>
            <SerialAndBatchNumbersBaseLine>long</SerialAndBatchNumbersBaseLine>
            <BinActionType>long</BinActionType>
            <BaseLineNumber>long</BaseLineNumber>
          </row>
        </StockTransferLinesBinAllocations>
        <StockTransfer_TaxExtension>
          <row>
            <!-- multiple such elements are allowed  -->
            <SupportVAT>string</SupportVAT>
            <FormNumber>string</FormNumber>
            <TransactionCategory>string</TransactionCategory>
          </row>
        </StockTransfer_TaxExtension>
      </BO>
    </BOM>
    Kind regards,
    Radek

  • B1IF variable Creation

    Hi Experts,
    Good Morning,
    I want create Variable in B1if, then how to get the value for that variable through SQL Call.
    Please help me out.
    Thanks
    Karthick

    HI ,
    Good Morning
    I tried the below Xpath in my local variable but it's showing following error. if some one known solution for this please help me out.
    Xpath:/vpf:Msg/vpf:Body/vpf:Payload[./@Role='C' and ./@id='atom1']/jdbc:ResultSet/jdbc:Row[1]/jdbc:LINENUM/text()
    Error Msg:com.sap.b1i.utilities.UtilException: UTE001 Nested exception: com.sap.engine.lib.xml.util.NestedException: SQL exception (207 - Invalid column name 'NaN'. - S0001)
    Thanks
    Karthick S

  • Why does JDBC keep connections open even though I close the resultsets?

    I attached my program and my output. Please bear with me for the long output. My question here is why do the connections remain even though I closed the resultsets. I need to reuse my prepared statements, but don't want to keep the oracle sessions open. Is this possible? What do I need to do?
    If you notice in the program, I have executed the query to find the number of open sessions 5 times.
    1) After creating the connections
    2) After creating the prepared statements
    3) After executing them
    4) After getString on the resultSets
    5) After closing the resultsets.
    And the sessions are still there even is Step 5 :-(
    import java.sql.*;
    * Title:
    * Description:
    * Copyright: Copyright (c) 2001
    * Company:
    * @author
    * @version 1.0
    public class Test {
    String dburl = "jdbc:oracle:thin:@oracle92:1521:oracle92";
    String query = "select s.username,s.sid ,s.logon_time, s.serial#,sql.sql_text"+
    " from v$session s, v$sqltext sql where sql.address = "+
    "s.sql_address and sql.hash_value = s.sql_hash_value "+
    "and upper(s.username) like 'KRTEMP%'"+
    " order by s.username ,s.sid ,s.serial# ,sql.piece" ;
    // String query = "select s.username, s.sid ,s.logon_time, s.status from v$session s where upper(s.username) like 'KRTEMP%'";
    public Test(int num) throws Exception {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection[] con = new Connection[num];
    for(int i=0; i<num; i++) {
    con[i] = DriverManager.getConnection(dburl, "krtemp", "krtemp");
    executeQuery();
    PreparedStatement[] ps = new PreparedStatement[num];
    for(int i=0; i<num; i++) {
    ps[i] = con.prepareStatement("select * from contact");
    executeQuery();
    ResultSet[] rs = new ResultSet[num];
    for(int i=0; i<num; i++) {
    rs[i] = ps[i].executeQuery();
    executeQuery();
    for(int i=0; i<num; i++) {
    ResultSetMetaData meta = rs[i].getMetaData();
    while(rs[i].next()) {
    for(int j=1; j<=meta.getColumnCount(); j++) {
    rs[i].getString(j);
    executeQuery();
    for(int i=0; i<num; i++) {
    rs[i].close();
    executeQuery();
    private void executeQuery() throws Exception {
    Connection con = DriverManager.getConnection(dburl, "krtemp", "krtemp");
    PreparedStatement ps = con.prepareStatement(query);
    ResultSet rs = ps.executeQuery();
    ResultSetMetaData meta = rs.getMetaData();
    System.out.println("-----");
    while(rs.next()) {
    for(int i=1; i<=meta.getColumnCount(); i++) {
    System.out.print(rs.getString(i));
    System.out.print(" ");
    System.out.println();
    System.out.println("-----");
    public static void main(String[] args) throws Exception {
    Test test = new Test(5);
    The output is
    KRTEMP 9 2005-06-27 17:09:30.0 5436 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS WH
    ERE PARAMETER ='NLS_
    KRTEMP 9 2005-06-27 17:09:30.0 5436 DATE_FORMAT'
    KRTEMP 34 2005-06-26 18:51:01.0 3629 rename tstore to store
    KRTEMP 37 2005-06-27 17:09:25.0 4209 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS W
    HERE PARAMETER ='NLS_
    KRTEMP 37 2005-06-27 17:09:25.0 4209 DATE_FORMAT'
    KRTEMP 74 2005-06-27 17:09:26.0 17625 select appId from profile_application_tabl
    e wher
    KRTEMP 74 2005-06-27 17:09:26.0 17625 e appName=:1 and appVersion=:2
    KRTEMP 83 2005-06-27 17:09:25.0 1771 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS W
    HERE PARAMETER ='NLS_
    KRTEMP 83 2005-06-27 17:09:25.0 1771 DATE_FORMAT'
    KRTEMP 105 2005-06-27 17:09:30.0 3296 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS
    WHERE PARAMETER ='NLS_
    KRTEMP 105 2005-06-27 17:09:30.0 3296 DATE_FORMAT'
    KRTEMP 111 2005-06-27 17:09:25.0 4878 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS
    WHERE PARAMETER ='NLS_
    KRTEMP 111 2005-06-27 17:09:25.0 4878 DATE_FORMAT'
    KRTEMP 153 2005-06-27 17:09:30.0 31065 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS
    WHERE PARAMETER ='NLS_
    KRTEMP 153 2005-06-27 17:09:30.0 31065 DATE_FORMAT'
    KRTEMP 163 2005-06-27 17:09:30.0 3205 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS
    WHERE PARAMETER ='NLS_
    KRTEMP 163 2005-06-27 17:09:30.0 3205 DATE_FORMAT'
    KRTEMP 183 2005-06-27 17:09:30.0 3465 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS
    WHERE PARAMETER ='NLS_
    KRTEMP 183 2005-06-27 17:09:30.0 3465 DATE_FORMAT'
    KRTEMP 191 2005-06-27 17:09:26.0 5438 select appId from profile_application_tabl
    e wher
    KRTEMP 191 2005-06-27 17:09:26.0 5438 e appName=:1 and appVersion=:2
    KRTEMP 256 2005-06-27 17:09:30.0 2718 select s.username,s.sid ,s.logon_time, s.s
    erial#,sql.sql_text fr
    KRTEMP 256 2005-06-27 17:09:30.0 2718 om v$session s, v$sqltext sql where sql.ad
    dress = s.sql_address
    KRTEMP 256 2005-06-27 17:09:30.0 2718 and sql.hash_value = s.sql_hash_value and
    upper(s.username) like
    KRTEMP 256 2005-06-27 17:09:30.0 2718 'KRTEMP%' order by s.username ,s.sid ,s.s
    erial# ,sql.piece
    KRTEMP 9 2005-06-27 17:09:30.0 5436 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS WH
    ERE PARAMETER ='NLS_
    KRTEMP 9 2005-06-27 17:09:30.0 5436 DATE_FORMAT'
    KRTEMP 34 2005-06-26 18:51:01.0 3629 rename tstore to store
    KRTEMP 37 2005-06-27 17:09:25.0 4209 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS W
    HERE PARAMETER ='NLS_
    KRTEMP 37 2005-06-27 17:09:25.0 4209 DATE_FORMAT'
    KRTEMP 74 2005-06-27 17:09:26.0 17625 select appId from profile_application_tabl
    e wher
    KRTEMP 74 2005-06-27 17:09:26.0 17625 e appName=:1 and appVersion=:2
    KRTEMP 83 2005-06-27 17:09:25.0 1771 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS W
    HERE PARAMETER ='NLS_
    KRTEMP 83 2005-06-27 17:09:25.0 1771 DATE_FORMAT'
    KRTEMP 105 2005-06-27 17:09:30.0 3296 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS
    WHERE PARAMETER ='NLS_
    KRTEMP 105 2005-06-27 17:09:30.0 3296 DATE_FORMAT'
    KRTEMP 111 2005-06-27 17:09:25.0 4878 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS
    WHERE PARAMETER ='NLS_
    KRTEMP 111 2005-06-27 17:09:25.0 4878 DATE_FORMAT'
    KRTEMP 153 2005-06-27 17:09:30.0 31065 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS
    WHERE PARAMETER ='NLS_
    KRTEMP 153 2005-06-27 17:09:30.0 31065 DATE_FORMAT'
    KRTEMP 163 2005-06-27 17:09:30.0 3205 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS
    WHERE PARAMETER ='NLS_
    KRTEMP 163 2005-06-27 17:09:30.0 3205 DATE_FORMAT'
    KRTEMP 183 2005-06-27 17:09:30.0 3465 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS
    WHERE PARAMETER ='NLS_
    KRTEMP 183 2005-06-27 17:09:30.0 3465 DATE_FORMAT'
    KRTEMP 191 2005-06-27 17:09:26.0 5438 select appId from profile_application_tabl
    e wher
    KRTEMP 191 2005-06-27 17:09:26.0 5438 e appName=:1 and appVersion=:2
    KRTEMP 232 2005-06-27 17:09:31.0 5893 select s.username,s.sid ,s.logon_time, s.s
    erial#,sql.sql_text fr
    KRTEMP 232 2005-06-27 17:09:31.0 5893 om v$session s, v$sqltext sql where sql.ad
    dress = s.sql_address
    KRTEMP 232 2005-06-27 17:09:31.0 5893 and sql.hash_value = s.sql_hash_value and
    upper(s.username) like
    KRTEMP 232 2005-06-27 17:09:31.0 5893 'KRTEMP%' order by s.username ,s.sid ,s.s
    erial# ,sql.piece
    KRTEMP 34 2005-06-26 18:51:01.0 3629 rename tstore to store
    KRTEMP 37 2005-06-27 17:09:25.0 4209 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS W
    HERE PARAMETER ='NLS_
    KRTEMP 37 2005-06-27 17:09:25.0 4209 DATE_FORMAT'
    KRTEMP 74 2005-06-27 17:09:26.0 17625 select appId from profile_application_tabl
    e wher
    KRTEMP 74 2005-06-27 17:09:26.0 17625 e appName=:1 and appVersion=:2
    KRTEMP 83 2005-06-27 17:09:25.0 1771 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS W
    HERE PARAMETER ='NLS_
    KRTEMP 83 2005-06-27 17:09:25.0 1771 DATE_FORMAT'
    KRTEMP 111 2005-06-27 17:09:25.0 4878 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS
    WHERE PARAMETER ='NLS_
    KRTEMP 111 2005-06-27 17:09:25.0 4878 DATE_FORMAT'
    KRTEMP 232 2005-06-27 17:09:31.0 5893 select s.username,s.sid ,s.logon_time, s.s
    erial#,sql.sql_text fr
    KRTEMP 232 2005-06-27 17:09:31.0 5893 om v$session s, v$sqltext sql where sql.ad
    dress = s.sql_address
    KRTEMP 232 2005-06-27 17:09:31.0 5893 and sql.hash_value = s.sql_hash_value and
    upper(s.username) like
    KRTEMP 232 2005-06-27 17:09:31.0 5893 'KRTEMP%' order by s.username ,s.sid ,s.s
    erial# ,sql.piece
    KRTEMP 256 2005-06-27 17:09:31.0 2783 select s.username,s.sid ,s.logon_time, s.s
    erial#,sql.sql_text fr
    KRTEMP 256 2005-06-27 17:09:31.0 2783 om v$session s, v$sqltext sql where sql.ad
    dress = s.sql_address
    KRTEMP 256 2005-06-27 17:09:31.0 2783 and sql.hash_value = s.sql_hash_value and
    upper(s.username) like
    KRTEMP 256 2005-06-27 17:09:31.0 2783 'KRTEMP%' order by s.username ,s.sid ,s.s
    erial# ,sql.piece
    KRTEMP 9 2005-06-27 17:09:30.0 5436 select * from contact
    KRTEMP 34 2005-06-26 18:51:01.0 3629 rename tstore to store
    KRTEMP 37 2005-06-27 17:09:25.0 4209 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS W
    HERE PARAMETER ='NLS_
    KRTEMP 37 2005-06-27 17:09:25.0 4209 DATE_FORMAT'
    KRTEMP 74 2005-06-27 17:09:26.0 17625 select appId from profile_application_tabl
    e wher
    KRTEMP 74 2005-06-27 17:09:26.0 17625 e appName=:1 and appVersion=:2
    KRTEMP 83 2005-06-27 17:09:25.0 1771 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS W
    HERE PARAMETER ='NLS_
    KRTEMP 83 2005-06-27 17:09:25.0 1771 DATE_FORMAT'
    KRTEMP 105 2005-06-27 17:09:30.0 3296 select * from contact
    KRTEMP 111 2005-06-27 17:09:25.0 4878 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS
    WHERE PARAMETER ='NLS_
    KRTEMP 111 2005-06-27 17:09:25.0 4878 DATE_FORMAT'
    KRTEMP 153 2005-06-27 17:09:30.0 31065 select * from contact
    KRTEMP 163 2005-06-27 17:09:30.0 3205 select * from contact
    KRTEMP 173 2005-06-27 17:09:31.0 3922 select s.username,s.sid ,s.logon_time, s.s
    erial#,sql.sql_text fr
    KRTEMP 173 2005-06-27 17:09:31.0 3922 om v$session s, v$sqltext sql where sql.ad
    dress = s.sql_address
    KRTEMP 173 2005-06-27 17:09:31.0 3922 and sql.hash_value = s.sql_hash_value and
    upper(s.username) like
    KRTEMP 173 2005-06-27 17:09:31.0 3922 'KRTEMP%' order by s.username ,s.sid ,s.s
    erial# ,sql.piece
    KRTEMP 183 2005-06-27 17:09:30.0 3465 select * from contact
    KRTEMP 191 2005-06-27 17:09:26.0 5438 select appId from profile_application_tabl
    e wher
    KRTEMP 191 2005-06-27 17:09:26.0 5438 e appName=:1 and appVersion=:2
    KRTEMP 232 2005-06-27 17:09:31.0 5893 select s.username,s.sid ,s.logon_time, s.s
    erial#,sql.sql_text fr
    KRTEMP 232 2005-06-27 17:09:31.0 5893 om v$session s, v$sqltext sql where sql.ad
    dress = s.sql_address
    KRTEMP 232 2005-06-27 17:09:31.0 5893 and sql.hash_value = s.sql_hash_value and
    upper(s.username) like
    KRTEMP 232 2005-06-27 17:09:31.0 5893 'KRTEMP%' order by s.username ,s.sid ,s.s
    erial# ,sql.piece
    KRTEMP 256 2005-06-27 17:09:31.0 2783 select s.username,s.sid ,s.logon_time, s.s
    erial#,sql.sql_text fr
    KRTEMP 256 2005-06-27 17:09:31.0 2783 om v$session s, v$sqltext sql where sql.ad
    dress = s.sql_address
    KRTEMP 256 2005-06-27 17:09:31.0 2783 and sql.hash_value = s.sql_hash_value and
    upper(s.username) like
    KRTEMP 256 2005-06-27 17:09:31.0 2783 'KRTEMP%' order by s.username ,s.sid ,s.s
    erial# ,sql.piece
    KRTEMP 9 2005-06-27 17:09:30.0 5436 select * from contact
    KRTEMP 34 2005-06-26 18:51:01.0 3629 rename tstore to store
    KRTEMP 37 2005-06-27 17:09:25.0 4209 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS W
    HERE PARAMETER ='NLS_
    KRTEMP 37 2005-06-27 17:09:25.0 4209 DATE_FORMAT'
    KRTEMP 74 2005-06-27 17:09:26.0 17625 select appId from profile_application_tabl
    e wher
    KRTEMP 74 2005-06-27 17:09:26.0 17625 e appName=:1 and appVersion=:2
    KRTEMP 83 2005-06-27 17:09:25.0 1771 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS W
    HERE PARAMETER ='NLS_
    KRTEMP 83 2005-06-27 17:09:25.0 1771 DATE_FORMAT'
    KRTEMP 105 2005-06-27 17:09:30.0 3296 select * from contact
    KRTEMP 111 2005-06-27 17:09:25.0 4878 SELECT VALUE FROM NLS_INSTANCE_PARAMETERS
    WHERE PARAMETER ='NLS_
    KRTEMP 111 2005-06-27 17:09:25.0 4878 DATE_FORMAT'
    KRTEMP 153 2005-06-27 17:09:30.0 31065 select * from contact
    KRTEMP 163 2005-06-27 17:09:30.0 3205 select * from contact
    KRTEMP 183 2005-06-27 17:09:30.0 3465 select * from contact
    KRTEMP 191 2005-06-27 17:09:26.0 5438 select appId from profile_application_tabl
    e wher
    KRTEMP 191 2005-06-27 17:09:26.0 5438 e appName=:1 and appVersion=:2
    KRTEMP 204 2005-06-27 17:09:32.0 1478 select s.username,s.sid ,s.logon_time, s.s
    erial#,sql.sql_text fr
    KRTEMP 204 2005-06-27 17:09:32.0 1478 om v$session s, v$sqltext sql where sql.ad
    dress = s.sql_address
    KRTEMP 204 2005-06-27 17:09:32.0 1478 and sql.hash_value = s.sql_hash_value and
    upper(s.username) like
    KRTEMP 204 2005-06-27 17:09:32.0 1478 'KRTEMP%' order by s.username ,s.sid ,s.s
    erial# ,sql.piece
    KRTEMP 232 2005-06-27 17:09:31.0 5893 select s.username,s.sid ,s.logon_time, s.s
    erial#,sql.sql_text fr
    KRTEMP 232 2005-06-27 17:09:31.0 5893 om v$session s, v$sqltext sql where sql.ad
    dress = s.sql_address
    KRTEMP 232 2005-06-27 17:09:31.0 5893 and sql.hash_value = s.sql_hash_value and
    upper(s.username) like
    KRTEMP 232 2005-06-27 17:09:31.0 5893 'KRTEMP%' order by s.username ,s.sid ,s.s
    erial# ,sql.piece
    KRTEMP 256 2005-06-27 17:09:31.0 2783 select s.username,s.sid ,s.logon_time, s.s
    erial#,sql.sql_text fr
    KRTEMP 256 2005-06-27 17:09:31.0 2783 om v$session s, v$sqltext sql where sql.ad
    dress = s.sql_address
    KRTEMP 256 2005-06-27 17:09:31.0 2783 and sql.hash_value = s.sql_hash_value and
    upper(s.username) like
    KRTEMP 256 2005-06-27 17:09:31.0 2783 'KRTEMP%' order by s.username ,s.sid ,s.s
    erial# ,sql.piece

    Why do the connections stay open? Because you haven't closed them.
    You answered your own question: obviously closing the ResultSet is NOT the same thing as closing the connection.
    When you do a query, you want to get the connection, statement, and result set, load the data from the result set into an object or data structure, and then immediately close them all again in reverse order of creation. You want to keep the scope as narrow as possible. You want to use a connection pool to keep the cost of obtaining a connection down. You should leave caching of the PreparedStatements to the JDBC driver.
    %

  • Help with resultset from jdbc

    When I run this program, the result set show up in the results textarea but it does not start a new line after each record even after inserting the "\n" escape character
    import java.awt.*;
    import java.sql.*;
    import java.awt.event.*;
    import javax.swing.*;
    * @author wezi
    * A java program for keeping track of the inventory of
    * books belonging to the ACM bookclub of Riverside
    public class ACMBooks extends JFrame
         private JTabbedPane mainTab;
         private JPanel connectpane, querypane, processpane, adminpane;
         private JPanel quadpane[] = new JPanel[4];
         //components for pane 1
         private JTextField txtUser, txtPort, txtHost, txtdb;
         private JLabel lbluser, lblpasswd, lblport, lblhost, lbldb, lblstatus;
         private JPasswordField pwdconnect;
         private JButton btnConnect ;
         private String tooltip[] = {"Default Name = bookdb","",
                   "Default port for MySQL = 3306",
                    "Default host is localhost", "Default database is acmbooks"};
         //Components for pane 2
         private JPanel sqlpane, searchpane, resultspane;
         private JTextArea txaSQL, txaResults;
         private JButton btnQuery, btnSearch, btnReset;
         private JLabel lblAuthor, lblTitle, lblISBN, lblCategory;
         private JTextField txtauthor, txttitle, txtisbn, txtCat;
         private JScrollPane scroller;
         //Components for panel 3
         private JPanel checkIn, checkOut;
         private GridLayout gl,gl2, gl3;
         private GridBagLayout gbl = new GridBagLayout();
         private GridBagConstraints gbc = new GridBagConstraints();
         private GridBagConstraints gbc2 = new GridBagConstraints();
         //private String pwd;
         //Set up the GUI
         public ACMBooks()
              super("ACM Book Library");
              lbldb = new JLabel("Database");
              lblstatus = new JLabel("Connection settings");
              gl = new GridLayout(2,2);
              Container cont = getContentPane();
              mainTab = new JTabbedPane();
              connectpane = new JPanel();
              adminpane = new JPanel();
              //set up the connection pane GUI
              connectpane.setLayout(gl);
              for(int i=0; i<4; i++)
                   quadpane[i] = new JPanel();
                   connectpane.add(quadpane);
              gbc.insets = new Insets(0,20,0,0);
              quadpane[0].setLayout(gbl);
              lbluser = new JLabel("User Name:");
              gbc.anchor = GridBagConstraints.NORTHEAST;
              gbc.gridx = 0; gbc.gridy = 0;
              gbc.weightx = 0.5; gbc.weighty = 0.5;
              quadpane[0].add(lbluser,gbc);
              lblpasswd = new JLabel("Password:");
              gbc.gridx = 0; gbc.gridy = 1;
              quadpane[0].add(lblpasswd,gbc);
              lblport = new JLabel("Port:");
              gbc.gridx = 0; gbc.gridy = 2;
              quadpane[0].add(lblport,gbc);
              lblhost = new JLabel("Host:");
              gbc.gridx = 0; gbc.gridy = 3;
              quadpane[0].add(lblhost,gbc);
              lbldb = new JLabel("Database:");
              gbc.gridx = 0; gbc.gridy = 4;
              quadpane[0].add(lbldb,gbc);
              gbc.anchor = GridBagConstraints.NORTHWEST;
              gbc.insets = new Insets(0,10,0,0);
              gbc.gridx = 1; gbc.gridy = 0;
              txtUser = new JTextField(10);
              txtUser.setToolTipText("Default username = bookdb");
              quadpane[0].add(txtUser,gbc);
              gbc.gridx = 1; gbc.gridy = 2;
              txtPort = new JTextField(10);
              txtPort.setToolTipText("Default port = 3306");
              quadpane[0].add(txtPort,gbc);
              gbc.gridx = 1; gbc.gridy = 3;
              txtHost = new JTextField(10);
              txtHost.setToolTipText("Default host = localhost");
              quadpane[0].add(txtHost,gbc);
              gbc.gridx = 1; gbc.gridy = 4;
              txtdb = new JTextField(10);
              txtdb.setToolTipText("Default database = acmbooks");
              quadpane[0].add(txtdb,gbc);
              pwdconnect = new JPasswordField(10);
              gbc.gridx = 1; gbc.gridy = 1;
              quadpane[0].add(pwdconnect,gbc);
              //Create a connection button
              btnConnect = new JButton("Connect");
              gbc.anchor = GridBagConstraints.NORTHWEST;
              gbc.gridx = 2; gbc.gridy = 4;
              quadpane[0].add(btnConnect,gbc);
              //create the reset button
              btnReset = new JButton(" Reset ");
              btnReset.setSize(btnConnect.getHeight(),btnConnect.getWidth());
              gbc.gridx = 2; gbc.gridy = 3;
              quadpane[0].add(btnReset,gbc);
    //Connection status
              lblstatus = new JLabel();
              quadpane[3].setLayout(gbl);
              gbc.anchor = GridBagConstraints.SOUTHEAST;
              gbc.insets = new Insets(0,10,20,20);
              quadpane[3].add(lblstatus,gbc);
              //Add a border to the first pane & add it to the main container
              quadpane[0].setBorder(BorderFactory.createTitledBorder("Details"));
              mainTab.addTab("Connection Settings",null,connectpane,"connections");
              //Create the second tab (Query pane)
              querypane = new JPanel();
              GridBagLayout gblquery= new GridBagLayout();
              GridBagConstraints gbcquery = new GridBagConstraints();
              gl2 = new GridLayout(4,1);
              querypane.setLayout(gblquery);
              //The sql query pane
              sqlpane = new JPanel();
              sqlpane.setLayout(gbl);
              gbc2.gridx = 0; gbc2.gridy = 0;
              gbc2.weightx = 0.5; gbc2.weighty = 0.5;
              txaSQL = new JTextArea(4,44);
              txaSQL.setBorder(BorderFactory.createLoweredBevelBorder());
              gbc2.anchor = GridBagConstraints.NORTHWEST;
              gbc2.insets = new Insets(0,10,0,0);
              sqlpane.add(txaSQL,gbc2);
              gbc2.gridx = 1; gbc2.gridy = 0;
              btnQuery = new JButton("Enter Query");
              gbc2.insets = new Insets(0,16,5,10);
              gbc2.anchor = GridBagConstraints.SOUTHEAST;
              sqlpane.add(btnQuery,gbc2);
              sqlpane.setBorder(BorderFactory.createTitledBorder("SQL Queries:"));
              gbcquery.gridheight =1; gbcquery.gridwidth = 1;
              gbcquery.gridx = 0; gbcquery.gridy = 0;
              gbcquery.anchor = GridBagConstraints.NORTHWEST;
              gbcquery.weightx = 0.5; gbcquery.weighty =0.5;
              gbcquery.fill =GridBagConstraints.REMAINDER;
              gbcquery.insets = new Insets(0,0,2,0);
              gbcquery.ipadx = 1; gbcquery.ipady = 1;
              querypane.add(sqlpane,gbcquery);
              //The search by pane
              searchpane = new JPanel();
              searchpane.setLayout(gbl);
              gbc2.insets = new Insets(0,14,5,5);
              lblAuthor = new JLabel("Author:");
              gbc2.anchor = GridBagConstraints.NORTHEAST;
              gbc2.gridx = 0; gbc2.gridy = 0;
              searchpane.add(lblAuthor,gbc2);
              lblTitle = new JLabel("Title:");
              gbc2.gridx = 0; gbc2.gridy = 1;
              searchpane.add(lblTitle,gbc2);
              lblISBN = new JLabel("ISBN:");
              gbc2.gridx = 2; gbc2.gridy = 0;
              searchpane.add(lblISBN,gbc2);
              lblCategory = new JLabel("Category:");
              gbc2.gridx = 2; gbc2.gridy =1;
              searchpane.add(lblCategory,gbc2);
              txtauthor = new JTextField(15);
              gbc2.gridx = 1; gbc2.gridy = 0;
              gbc2.anchor = GridBagConstraints.NORTHWEST;
              searchpane.add(txtauthor,gbc2);
              txttitle = new JTextField(15);
              gbc2.gridx = 1; gbc2.gridy = 1;
              searchpane.add(txttitle,gbc2);
              txtisbn = new JTextField(15);
              gbc2.gridx = 3; gbc2.gridy = 0;
              searchpane.add(txtisbn,gbc2);
              txtCat = new JTextField(15);
              gbc2.gridx = 3; gbc2.gridy = 1;
              searchpane.add(txtCat,gbc2);
              btnSearch = new JButton("Search >>>");
              gbc2.anchor = GridBagConstraints.SOUTHEAST;
              gbc2.gridx = 4; gbc2.gridy = 1;
              gbc2.insets = new Insets(0,5,20,10);
              searchpane.add(btnSearch,gbc2);
              searchpane.setBorder(BorderFactory.createTitledBorder("Search By:"));
              gbcquery.gridheight =1; gbcquery.gridwidth = 1;
              gbcquery.gridx = 0; gbcquery.gridy = 1;
              gbcquery.insets = new Insets(0,0,0,0);
              querypane.add(searchpane,gbcquery);
              //The results pane
              resultspane = new JPanel();
              resultspane.setSize(20,60);
              resultspane.setLayout(gbl);
              gbc2.gridx = 0; gbc2.gridy = 0;
              gbc2.anchor = GridBagConstraints.NORTHWEST;
              txaResults = new JTextArea(" ",9,55);
              scroller = new JScrollPane(txaResults);
              resultspane.add(new JScrollPane(txaResults));
              txaResults.setBorder(BorderFactory.createLoweredBevelBorder());
              resultspane.add(txaResults,gbc2);
              resultspane.setBorder(BorderFactory.createTitledBorder("Results:"));
              gbcquery.gridheight =3; gbcquery.gridwidth = 1;
              gbcquery.gridx = 0; gbcquery.gridy = 2;
              gbcquery.weightx = 1; gbcquery.weighty = 1;
              querypane.add(resultspane,gbcquery);
              mainTab.addTab("Query Entry",null,querypane,"Query page");
              //Create a third tab to process book checkin and out
              processpane = new JPanel();
              gl3 = new GridLayout(4,1);
              processpane.setLayout(gl3);
              //Create the checkin panel
              checkIn = new JPanel();
              checkIn.setBorder(BorderFactory.createTitledBorder("Return Books"));
              checkIn.setLayout(gbl);
              //Create the checkout panel
              checkOut = new JPanel();
              checkOut.setBorder(BorderFactory.createTitledBorder("Check Books Out"));
              processpane.add(checkOut,gl3);
              processpane.add(checkIn,gl3);
              mainTab.addTab("Process Books",null, processpane,"Book Processing page");
              //Create an administration panel
              adminpane = new JPanel();
              mainTab.addTab("Admin",null,adminpane,"Administration page");
              cont.add(mainTab);
              //Register the eventhandlers
              ButtonHandler btnHandler = new ButtonHandler();
              btnConnect.addActionListener(btnHandler);
              btnQuery.addActionListener(btnHandler);
              btnSearch.addActionListener(btnHandler);
              btnReset.addActionListener(btnHandler);
              setSize(650,460);
              setVisible(true);
         }//end constructor
         private class ButtonHandler implements ActionListener
              public void actionPerformed(ActionEvent e)
                   String errMsg;
                   Statement stmt;
                   ResultSet rs;
                   Connection con = null;
                   String pwd;
                   String user;
                   //Create a url from user input
                   String url = "jdbc:mysql://";
                   url += txtHost.getText();
                   url += ":";
                   url += txtPort.getText();
                   url += "/";
                   url += txtdb.getText();
              try
                   //Register the JDBC Mysql Driver
                   Class.forName("com.mysql.jdbc.Driver");
                   //Get the password and user name for the database
                   pwd = new String(pwdconnect.getPassword());
                   user = new String(txtUser.getText());
                   //Open a connection to the database
                   con = DriverManager.getConnection(url,user,pwd);
                        //Add the action event for the btnReset
                        if(e.getSource() == btnReset)
                             //Clear all the text fields and the status label
                             lblstatus.setText(" ");
                             txtUser.setText(" ");
                             txtdb.setText(" ");
                             txtHost.setText(" ");
                             txtPort.setText(" ");
                             pwdconnect.setText("");
                             txaResults.setText(" ");
                             txaSQL.setText(" ");
                             try{
                                  if(!con.isClosed())
                                       con.close();
                             catch(Exception closeError)
                                  String clErr = new String(closeError.toString());
                                  txaResults.setText(clErr);
                        }//end btnReset
                   //If the connect button is pressed
                   if(e.getSource() == btnConnect)
                   if(!con.isClosed())//if connection is open
                        lblstatus.setText("");
                        lblstatus.setVisible(true);
                        lblstatus.setText("Connected to " + txtdb.getText()
                             +" on "     + txtHost.getText());
                   else
                   { lblstatus.setText("Not Connected"); }
                   }//end btnConnect
                   if(e.getSource() == btnQuery || e.getSource()== txaSQL)
                        String strQuery = new String(txaSQL.getText());
                        ResultSetMetaData rsmtd;
                        int numCol;
                        try
                             stmt = con.createStatement();
                             rs = stmt.executeQuery(strQuery);
                             rsmtd = rs.getMetaData(); //to get metadata
                             numCol = rsmtd.getColumnCount(); //for number of columns
                             String strCol[] = new String[numCol];
                             String colName[] = new String[numCol];
                             String txaColumn = new String("");
                             String strHeading = new String("");
                             //Write the results of the query to the results text area
                             txaResults.setText(" ");          
                             //Get the data from the result set
                             //first get the column headings
                             for(int i=1; i<=numCol; i++)
                                  colName[i-1] = rsmtd.getColumnName(i);
                                  strHeading += colName[i-1] + "\t";
                             txaResults.setText(strHeading + "\n");
                             while(rs.next())
                                  //Get the values & create a display column
                                  for(int i=1; i<=numCol; i++)
                                       strCol[i-1] = rs.getString(i);
                                       txaColumn += strCol[i-1] + "\t";
                                  }//end for
                                  //Display the values
                                  txaResults.append( txaColumn + "\n");
                        catch(Exception sqlError)
                             txaResults.setText("");
                             String strSqlErr = new String(sqlError.toString());
                             txaResults.setText(strSqlErr);
                   }//end btnQuery
                   if(e.getSource() == btnSearch)
                        try
                             String strAuthor = new String(txtauthor.getText());
                             String strISBN = new String(txtisbn.getText());
                             String strTitle = new String(txttitle.getText());
                             String strCat = new String(txtCat.getText());
                             * Need to add code to change the search fields to
                             * any if the field is blank i.e if the field is blank
                             * search using a wild card. If all fields are blank, then
                             * do not search at all.
                             stmt = con.createStatement();
                             rs = stmt.executeQuery("Select * from books where" +
                                       " bookAuthor = " + strAuthor +
                                       " bookISBN = " + strISBN +
                                       " bookTitle = " + strTitle +
                                       "bookCategory = " + strCat);
                        catch(Exception searchError)
                             errMsg = new String(searchError.toString());
                             txaResults.setText("");
                             txaResults.setText(errMsg);
                   }//end btnSearch
              catch(Exception connectError)
                   errMsg = new String(connectError.toString());
                   lblstatus.setText("");
                   lblstatus.setText(errMsg);
              }//end actionPer
         }//end ButtonHandler
         public static void main(String[] args)
              ACMBooks app = new ACMBooks();
              app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         }//end main
    }//end class ACMBooks

    Hi,
    Here is a template of Manifest file which you can use for your reference:
    Manifest-Version: 1.0
    Created-By: Apache Ant 1.5.1
    Main-Class: com.pkg1.pkg2.MainClass
    Class-Path: . ./libs/ ./libs/database-driver.jar ./libs/jdom.jar ./libs/xercesImpl.jar ./libs/log4j.jar ....
    Name: com.pkg1.pkg2Main-Class: Specify the main class with complete package name
    Class-Path: Put all the jar file name with path
    <b>So the solution to your problem is to put you jar file name with the relative or complete path</b>
    Thanks
    Duke.

  • Scroll not a method of ResultSet on JDBC 2.0? Install Missing?

    Hi,
    1) (rset.scroll(lastRow - startRow) Is this an oracle extension
    to ResultSet? Reference the sample 4 at:
    http://download-west.oracle.com/otndoc/oracle9i/901_doc/appdev.90
    1/a88894/adx07xsu.htm
    Also how is that example 4 suppose to replace the same class
    in example 3? then why it is declared as public class pageTest()
    2) Am I missing any installed portion? I am working on an oracle
    8.1.7 version, and has only done the following to get XSU
    working:
    loadjava -user scott/tiger -r -v xmlparserv2.jar
    loadjava -user scott/tiger -r -v xmlplsql.jar
    sqlplus scott/tiger @/$OH/xdk/plsql/parser/bin/load.sql
    I was able to make, compile and run the samples at
    $OH/xdk/java/parser/demo
    I have not done any:
    xsulload.csh - I do not have this file.
    xdkload - I did not execute this,were not part of original 8i
    install
    catxsu.sql - I do not have this file, nowhere to be found in
    $OH/rdbms/admin/
    oraclexsql.jar - I have not loaded either as I have not found
    instructions or steps to load this.
    Thanks in advance for any help. Happy New Year!

    I am trying to use ResultSet.TYPE_SCROLL_SENSITIVE and
    CONCUR_UPDATABLE (using IBM DB2 JDBC 2.0) but I get
    run time error :
    SQL Exception.SQLState = null Error code = 0 Error
    message = Updatable result set is not supported by
    this version of the DB2 JDBC 2.0 driver.
    Any suggestion or help is appreciated.
    Has anyone heard that IBM DB2 implementation does not
    support updatable and scroll_sensitive?It gave you a precise error message, and you don't believe the error message, thinking somehow you can get around it anyway, making it support updatable result sets...
    You should check out this link:
    http://www.hov-hov.dk/you.htm

  • Problem with get ResultSet from rmi jdbc method. Help.

    Hi,
    I am writing a rmi jdbc server. I got all the rmi methods working, but I am trying to get the data from the ResultSet. After the query, I set the fields in the serialiable class and return it back to the client. However, I noticed that it does called init(), but not the setField calls. When it calls the first setField in the serialiable class, the method is never called. Can anyone give some guidance.
    Thanks,
    Rage
    This method is called from the client to set all the data in the Serialiable class and return it to the client.
    public Collection fetchResultSet() throws RemoteException
    System.out.println("Entering fetchResultSet");
    Collection resultSetColl = new ArrayList();
    QueryResultSet recordset;
    try
    int rowCount = 0;
    ResultSetMetaData rsmd = rs.getMetaData(); // Get data dictionary information
    int columnCount = rsmd.getColumnCount();
    System.out.println("got column count");
    System.out.println("" + rowCount + " rows, " +
    columnCount + " columns");
    if (rs == null) System.out.println("rs is null");
    if (rs.next())
    System.out.println("Parsing RS");
    recordset = new QueryResultSet();
    for (int i = 1; i <= columnCount; i++)
    System.out.println("set Fields = "+ rs.getString(i) );
    //recordset.setField(i,rs.getString(i));
    String strValue = rs.getString(i);
    recordset.setField(i,strValue);
    System.out.println("Added recordset" );
    resultSetColl.add(recordset);
    catch (Exception e)
    System.out.println(e.getMessage());
    closeResultSet();
    return resultSetColl;
    Here is my Serializable Class
    import java.io.*;
    import java.sql.*;
    public class QueryResultSet implements Serializable
    private String Field1;
    private String Field2;
    private String Field3;
    private String Field4;
    private String Field5;
    private String Field6;
    private String Field7;
    private String Field8;
    private String Field9;
    private String Field10;
    private String Field11;
    private String Field12;
    private String Field13;
    /** Creates a new instance of QueryResultSet */
    public QueryResultSet()
    init();
    public void init()
    System.out.println("QueryResultSet INIT()");
    Field1 = "";
    Field2 = "";
    Field3 = "";
    Field4 = "";
    Field5 = "";
    Field6 = "";
    Field7 = "";
    Field8 = "";
    Field9 = "";
    Field10 = "";
    Field11 = "";
    Field12 = "";
    Field13 = "";
    public String getField(int nField)
    System.out.println("QueryResultSet getField()");
    System.out.println("getField 1 = " + Field1);
    if (nField ==1)
    return Field1;
    else if (nField == 2)
    return Field2;
    else if (nField == 3)
    return Field3;
    else if (nField == 4)
    return Field4;
    else if (nField == 5)
    return Field5;
    else if (nField == 6)
    return Field6;
    else if (nField == 7)
    return Field7;
    else if (nField == 8)
    return Field8;
    else if (nField == 9)
    return Field9;
    else if (nField == 10)
    return Field10;
    else if (nField == 11)
    return Field11;
    else if (nField == 12)
    return Field12;
    else if (nField == 13)
    return Field13;
    return null;
    public void setField(int nField, String strField)
    System.out.println("QueryResultSet setField()");
    System.out.println("field #" String.valueOf(nField) " = " + strField);
    if (nField == 1)
    Field1 = strField;
    else if (nField == 2)
    Field2 = strField;
    else if (nField == 3)
    Field3 = strField;
    else if (nField == 4)
    Field4 = strField;
    else if (nField == 5)
    Field5 = strField;
    else if (nField == 6)
    Field6 = strField;
    else if (nField == 7)
    Field7 = strField;
    else if (nField == 8)
    Field8 = strField;
    else if (nField == 9)
    Field9 = strField;
    else if (nField == 10)
    Field10 = strField;
    else if (nField == 11)
    Field11 = strField;
    else if (nField == 12)
    Field12 = strField;
    else if (nField == 13)
    Field13 = strField;
    }

    You need to give us some information more. Like what rdbms are you using, what driver and how are you trying to access the resultset from java.
    I do not know what are you using. One thing I can tell you for sure is that the execute method returns a boolean. If you need a resultset you should run executeQuery.
    Kiros

  • JBuilder 3.1 Deployment/JDBC Exception - Exhausted Resultset

    I just installed JBuilder 3.1 with Oracle 8i (8.1.6) on NT workstation w/SP5 and am receiving error "java.sql.SQLException: Exhausted Resultset" upon choosing deploy for sample "Auctions" application profile. I have an idea this has to do with the number of rows returned by SQL statement associated with ResultSet rset declaration in method getvalue but don't know for sure. What's happening here?
    Thanks in advance for any assistance...
    Java/JBuilder neophyte

    As far as i know u can encounter an exhausted resultset exception if the JDBC version is prior 2.0 and that , the same resultset is tried to iterate more than once...... coz this was what i have experienced...

Maybe you are looking for

  • HP LaserJet Pro 200 Color MFP M276nw scan to mail with google.

    hello, i got a HP LaserJet Pro 200 Color MFP M276nw printer. and i want to use the scan to mail feature. But when i am setting up my google account as head account where the printer should send the mails from it doesn't work. i don't get the scan's i

  • How to connect a Cinema Display to alternative input?

    I want to upgrade my Mac Pro (2009) to a reasonably priced graphics card but there are very few that have a Mini Displayport input. How do I connect a Cinema display with only a Mini DP to an HDMI, Displayport or DVI input? (and still use the sound)

  • My touchscreen is not working right

    sceen is not allowing me to swipe the screen.  I can click and then double click to open what is on the screen but I cannot navigate to any other screen or scroll down.  how do I fix this?  I have already restarted and restored.

  • How to create a view with a column of counts of the occurence of values

    If my table is: ID 1 2 3 3 5 5 5 I want to create a view with the following result: ID   COUNT 1     1 2     1 3     2 5     3 How would I accomplish this?

  • Regarding datasource in app module

    Hi I am using jdev 11.1.1.5.0 I am creating an application using bounded task flow in which i want to use 2 datasource. In my use case..... I have 2 database user and both have same table with similar schema. I have created to datasource using both d