Oracle 8.1.6 Thin Driver with Multiple Result Sets

We're using Oracle 8.1.6 on NT using the latest driver release.
Java 1.2.2
We're experiencing problems with resultSet.next when we have multiple result sets open. What appears to be happening when you've read the last result set entry do a .next() call which should result in a false value we actually get java.sql.SQLException: ORA-01002: fetch out of sequence.
This seems to us that the driver is trying to go beyond the end of the result set.
We've checked JDBC standards (and examples on this site) and the code we've got is compliant. We've also found that the code produces the correct results under Oracle 7.3.4 and 8.0.4.
I can also say that there is no other activity on the db, so there are no issues such as roll back segments coming into play.
Any solutions, help, advice etc would be gratefully appreciated!
null

Phil,
By "multiple result sets open", do you mean you are using REF Cursors, or do you have multiple statements opened, each with its own ResultSet? If you could post an example showing what the problem is, that would be very helpful.
You don't happen to have 'for update' clause in your SQL statement, do you?
Thanks

Similar Messages

  • Stored Procedure With Multiple Result Sets As Report Source : Crosspost

    Hello Everyone,
    I have an issue where i have created a stored procedure that returns multiple result sets
    /* Input param = @SalesOrderID */
    SELECT * FROM Orders TB1
      INNER JOIN OrderDetails TB2 ON  TB1.ID = TB2.ID
    WHERE TB1.OrderID = @SalesOrderID
    SELECT * FROM Addresses
      WHERE Addresses.OrderID = @SalesOrderID AND Addresses.AddressType = 'Shipping'
    SELECT * FROM Addresses
      WHERE Addresses.OrderID = @SalesOrderID AND Addresses.AddressType = 'Billing'
    This is just a quick sample, the actual procedure is a lot more complex but this illustrates the theory.
    When I set the report source in Crystal X to the stored procedure it is only allowing me to add rows from the first result set.
    Is there any way to get around this issue?
    The reason that I would prefer to use a stored procedure to get all the data is simply performance. Without using one big stored procedure I would have to run at least 6 sub reports which is not acceptable because the number of sub reports could grow exponentially depending on the number of items for a particular sales order.
    Any ideas or input would be greatly appreciated.
    TIA
        - Adam
    P.S
    Sorry for the cross post, I originally posted this question [here|/community [original link is broken];
    but was informed that it might be the wrong forum
    Edited by: Adam Harris on Jul 30, 2008 9:44 PM

    Adam, apologies for the redirect, but it is better to have .NET posts in one place. That way anyone can search the forum for answers. (and I do not have the rights to move posts).
    Anyhow, as long as the report is created, you should be able to pass the datasets as:
    crReportDocument.Database.Tables(0).SetDataSource(dataSet.Tables("NAME_OF_TABLE"))
    Of course alternatively, (not sure if this is possible in your environment) you could create a multi-table ADO .NET dataset and pass that to the report.
    Ludek

  • Oracle 11.2.0.2g driver with IBM JRE(J2RE 1.5.0 IBM J9 2.3 Linux x86-32)

    Hi All,
    I am trying to use oracle 11.2 jdbc thin driver with IBM JRE and getting following exception messages.
    Details from Ojdbc5.jar
    Implementation-Version: 11.2.0.2.0
    Repository-Id: JAVAVM_11.2.0.2.0_LINUX_100812.1
    And Details from Java System Properties
    java.vm.info: J2RE 1.5.0 IBM J9 2.3 Linux x86-32 j9vmxi3223-20060504 (JIT enabled)
    J9VM - 20060501_06428_lHdSMR
    JIT - 20060428_1800_r8
    GC - 20060501_AA
    java.lang.ExceptionInInitializerError
    at java.lang.J9VMInternals.initialize(J9VMInternals.java:195)
    at javax.crypto.Cipher.getInstance(Unknown Source)
    at oracle.security.o5logon.O5LoginClientHelper.decryptAES(Unknown Source)
    at oracle.security.o5logon.O5LoginClientHelper.generateOAuthResponse(Unknown Source)
    at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:655)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:366)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:536)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:228)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
    at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
    at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294)
    at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1247)
    at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1221)
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
    at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
    at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
    at com.tes.archival.extractor.DataExtractorWithJdbcImpl.extractArchivalRecords(DataExtractorWithJdbcImpl.java:61)
    at com.tes.archival.executor.ExtractorExecutor$1.call(ExtractorExecutor.java:57)
    at com.tes.archival.executor.ExtractorExecutor$1.call(ExtractorExecutor.java:1)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:284)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
    at java.lang.Thread.run(Thread.java:797)
    Caused by: java.lang.SecurityException: Cannot set up certs for trusted CAs
    at javax.crypto.b.<clinit>(Unknown Source)
    at java.lang.J9VMInternals.initializeImpl(Native Method)
    at java.lang.J9VMInternals.initialize(J9VMInternals.java:177)
    ... 24 more
    Caused by: java.lang.SecurityException: Jurisdiction policy files are not signed by trusted signers!
    at javax.crypto.b.a(Unknown Source)
    at javax.crypto.b.a(Unknown Source)
    at javax.crypto.b.access$600(Unknown Source)
    at javax.crypto.b$0.run(Unknown Source)
    at java.security.AccessController.doPrivileged(AccessController.java:241)
    ... 27 more
    Any help in resolving this issue will be much appreaciated.
    Regards,
    Raman

    804915 wrote:
    Caused by: java.lang.SecurityException: Cannot set up certs for trusted CAs
    Caused by: java.lang.SecurityException: Jurisdiction policy files are not signed by trusted signers!Probably a permissions problem. Or something is wrong with the certs.

  • Problems storing CLOBs with build-in Oracle 8.1.6 thin driver of WebLogic 6.0 SP2

    Hi,
    I'm using the build-in Oracle 8.1.6 thin driver that comes with
    weblogic.jar of WebLogic 6.0 SP2. It doesn't store CLOBs. Here I have
    to use the class weblogic.jdbc.common.OracleClob. Why?
    WebLogic 5.1 SP 9 + Oracle 8.1.6 thin driver (external) does. Here I
    use the class oracle.sql.CLOB.
    Must I use a OCI driver?
    Thanks,
    Juergen

    I'd also recommend to switch to 8.1.7 thin driver. It's more stable.
    Regards,
    Slava Imeshev
    "NhaBep" <[email protected]> wrote in message
    news:3b71bbcf$[email protected]..
    >
    You can use thin driver to persist CLOB. One thing you must be sure to setautocommit
    to false. Hope this help.
    [email protected] (Juergen) wrote:
    Hi,
    I'm using the build-in Oracle 8.1.6 thin driver that comes with
    weblogic.jar of WebLogic 6.0 SP2. It doesn't store CLOBs. Here I have
    to use the class weblogic.jdbc.common.OracleClob. Why?
    WebLogic 5.1 SP 9 + Oracle 8.1.6 thin driver (external) does. Here I
    use the class oracle.sql.CLOB.
    Must I use a OCI driver?
    Thanks,
    Juergen

  • Memory leak in weblogic 6.0 sp2 oracle 8.1.7 thin driver

    Hi,
         I have a simple client that opens a database connection, selects from
    a table containing five rows of data (with four columns in each row)
    and then closes all connections. On running this in a loop, I get the
    following error after some time:
    <Nov 28, 2001 5:57:40 PM GMT+06:00> <Error> <Adapter>
    <OutOfMemoryError in
    Adapter
    java.lang.OutOfMemoryError
    <<no stack trace available>>
    >
    <Nov 28, 2001 5:57:40 PM GMT+06:00> <Error> <Kernel> <ExecuteRequest
    failed
    java.lang.OutOfMemoryError
    I am running with a heap size of 64 Mb. The java command that runs
    the client is:
    java -ms64m -mx64m -cp .:/opt/bea/wlserver6.0/lib/weblogic.jar
    -Djava.naming.f
    actory.initial=weblogic.jndi.WLInitialContextFactory
    -Djava.naming.provider.url=
    t3://garlic:7001 -verbose:gc Test
    The following is the client code that opens the db connection and does
    the select:
    import java.util.*;
    import java.sql.*;
    import javax.naming.*;
    import javax.sql.*;
    public class Test {
    private static final String strQuery = "SELECT * from tblPromotion";
    public static void main(String argv[])
    throws Exception
    String ctxFactory     = System.getProperty
    ("java.naming.factory.initial");
    String providerUrl     = System.getProperty
    ("java.naming.provider.url");
    Properties jndiEnv          = System.getProperties ();
    System.out.println ("ctxFactory : " + ctxFactory);
    System.out.println ("ProviderURL : " + providerUrl);
    Context ctx     = new InitialContext (jndiEnv);
    for (int i=0; i <1000000; i++)
    System.out.println("Running query for the "+i+" time");
    Connection con = null;
    Statement stmnt = null;
    ResultSet rs     = null;
    try
    DataSource ds     = (DataSource) ctx.lookup
    (System.getProperty("eaMDataStore", "jdbc/eaMarket"));
    con = ds.getConnection ();
    stmnt = con.createStatement();
    rs = stmnt.executeQuery(strQuery);
    while (rs.next ())
    //System.out.print(".");
    //System.out.println(".");
    ds = null;
    catch (java.sql.SQLException sqle)
    System.out.println("SQL Exception : "+sqle.getMessage());
    finally
    try {
    rs.close ();
    rs = null;
    //System.out.println("closed result set");
    } catch (Exception e) {
    System.out.println("Exception closing result set");
    try {
    stmnt.close ();
    stmnt = null;
    //System.out.println("closed statement");
    } catch (Exception e) {
    System.out.println("Exception closing result set");
    try {
    con.close();
    con = null;
    //System.out.println("closed connection");
    } catch (Exception e) {
    System.out.println("Exception closing connection");
    I am using the Oracle 8.1.7 thin driver. Please let me know if this
    memory leak is a known issue or if its something I am doing.
    thanks,
    rudy

    Repost in JDBC section ... very serious issue but it may be due to Oracle or
    to WL ... does it happen if you test inside WL itself?
    How many iterations does it take to blow? How long? Does changing to a
    different driver (maybe Cloudscape) have the same result?
    Peace,
    Cameron Purdy
    Tangosol Inc.
    << Tangosol Server: How Weblogic applications are customized >>
    << Download now from http://www.tangosol.com/download.jsp >>
    "R.C." <[email protected]> wrote in message
    news:[email protected]...
    Hi,
    I have a simple client that opens a database connection, selects from
    a table containing five rows of data (with four columns in each row)
    and then closes all connections. On running this in a loop, I get the
    following error after some time:
    <Nov 28, 2001 5:57:40 PM GMT+06:00> <Error> <Adapter>
    <OutOfMemoryError in
    Adapter
    java.lang.OutOfMemoryError
    <<no stack trace available>>
    >
    <Nov 28, 2001 5:57:40 PM GMT+06:00> <Error> <Kernel> <ExecuteRequest
    failed
    java.lang.OutOfMemoryError
    I am running with a heap size of 64 Mb. The java command that runs
    the client is:
    java -ms64m -mx64m -cp .:/opt/bea/wlserver6.0/lib/weblogic.jar
    -Djava.naming.f
    actory.initial=weblogic.jndi.WLInitialContextFactory
    -Djava.naming.provider.url=
    t3://garlic:7001 -verbose:gc Test
    The following is the client code that opens the db connection and does
    the select:
    import java.util.*;
    import java.sql.*;
    import javax.naming.*;
    import javax.sql.*;
    public class Test {
    private static final String strQuery = "SELECT * from tblPromotion";
    public static void main(String argv[])
    throws Exception
    String ctxFactory = System.getProperty
    ("java.naming.factory.initial");
    String providerUrl = System.getProperty
    ("java.naming.provider.url");
    Properties jndiEnv = System.getProperties ();
    System.out.println ("ctxFactory : " + ctxFactory);
    System.out.println ("ProviderURL : " + providerUrl);
    Context ctx = new InitialContext (jndiEnv);
    for (int i=0; i <1000000; i++)
    System.out.println("Running query for the "+i+" time");
    Connection con = null;
    Statement stmnt = null;
    ResultSet rs = null;
    try
    DataSource ds = (DataSource) ctx.lookup
    (System.getProperty("eaMDataStore", "jdbc/eaMarket"));
    con = ds.getConnection ();
    stmnt = con.createStatement();
    rs = stmnt.executeQuery(strQuery);
    while (rs.next ())
    //System.out.print(".");
    //System.out.println(".");
    ds = null;
    catch (java.sql.SQLException sqle)
    System.out.println("SQL Exception : "+sqle.getMessage());
    finally
    try {
    rs.close ();
    rs = null;
    //System.out.println("closed result set");
    } catch (Exception e) {
    System.out.println("Exception closing result set");
    try {
    stmnt.close ();
    stmnt = null;
    //System.out.println("closed statement");
    } catch (Exception e) {
    System.out.println("Exception closing result set");
    try {
    con.close();
    con = null;
    //System.out.println("closed connection");
    } catch (Exception e) {
    System.out.println("Exception closing connection");
    I am using the Oracle 8.1.7 thin driver. Please let me know if this
    memory leak is a known issue or if its something I am doing.
    thanks,
    rudy

  • Installing Lion clean on hard drive with multiple partitions

    I have a spring 2008 24" iMac running Snow Leopard.
    I am about to put a new 2TB hard drive in it and after I do that I want to do a clean install of Lion on it.
    I do not want to upgrade my Snow Leopard install to Lion. I will keep it on my back up drive as a fallback incase of serious workflow incompatiblities with the new OS.
    For my workflow I create and use multiple partitions (Mac OS,  Windows and multiple HFS+ for data) on my hard drive and I have seen that Lion creates it's own hidden recovery partition as well for the recovery functionality.
    My questions are:
    1) Will I have issues running Lion on a partition on a hard drive with multiple partitions that have different file systems?
    2) If I install Lion into one of these partitions will it create it's recovery partition within the space of the partition it is being installed into?
    3) I will be creating a clean install by downloading Lion using the App Store and then burning an installer DVD using instructions I found elsewhere and then using that to do the install on the new drive. Is that the best route to take?
    All my current data I will have on a backup external hard drive and after I complete the Lion install on the new larger drive I will manually reinstall all my software and move my data back from my backup drive to the new drive one partition at a time except of course for OS partition. I keep all my real user data outside of that partition anyway.

    I believe this article answers most of your questions.
    http://support.apple.com/kb/HT4718
    or possibly
    http://support.apple.com/kb/HT4649
    You will most likely run into the error message that "Some features of Mac OS X Lion are not supported for the disk" if you have multiple partitions set up, especially if they were not set up using Bootcamp and/or have serveral different file systems.
    You can confirm that the Recovery Partition will not be installed by checking Disk Utility for your current partition map scheme.
    This is most definitely not the end of the world as it is quite easy to create an external Recovery disk.
    1) No, you shouldn't have issues running Lion, but Recovery HD will not be created.
    2) No, and in your case it doesn't sound like it will be installed on your internal drive at all.
    3) Yes. If you begin with an empty partition, then install Lion that would be considered a clean install.
    Hope that helps.
    Autumn

  • Oracle 8.1.7 Thin Driver Resultsets

    A simple question I hope.
    We are using the Oracle 8.1.7 thin driver to connect Weblogic 6.0sp2 to an Oracle
    8 db. My question is regarding how the resultset is passed to the server. Is
    there cacheing? If so, is the cache recycled..i.e. for a 1000 row set are rows
    fed to the server 100 at a time? Or is the entire resultset passed at once.
    A general description of this transation or pointers to documentation would be
    greatly appreciated. Thanks for your consideration,
    Jason

    Jason Carter wrote:
    A simple question I hope.
    We are using the Oracle 8.1.7 thin driver to connect Weblogic 6.0sp2 to an Oracle
    8 db. My question is regarding how the resultset is passed to the server. Is
    there cacheing? If so, is the cache recycled..i.e. for a 1000 row set are rows
    fed to the server 100 at a time? Or is the entire resultset passed at once.
    A general description of this transation or pointers to documentation would be
    greatly appreciated. Thanks for your consideration,
    JasonHi. This is entirely an oracle DBMS and driver question. From what I can glean from
    oracle documentation, there is a settable driver property which sets how many rows
    the driver gets in one request. This implies the DBMS and driver will cooperate to
    get a given result set in chunks.
    Joe

  • Working with multiple results of a complex query

    Hi all!
    As I "advance" in learning PL/SQL with oracle, I now get stuck in handling multiple results of a complex query. As far as I know, I cannot use a cursor here, as there is no table where the cursor could point to.
    Here is the concept of what I want to do (pseudocode):
    foreach result in SELECT * FROM table_1, table_n WHERE key_1 = foreign_key_in_n;
        -- do someting with the resultHere is my attemt, that freezes the browser gui and throws an internal database error:
    declare
        type t_stock is record(
                baggage_id  baggage.baggage_id%type,
                section_id  sections.section_id%type,
                shelf_id    shelves.shelf_id%type
        v_stock t_stock;
        rcnt number(2);
    begin
    dbms_output.put_line(TO_CHAR(rcnt));
    loop
         SELECT COUNT(*) INTO rcnt FROM (
                   SELECT baggage.baggage_id, sections.section_id, shelves.shelf_id
                   FROM baggage, sections, shelves
                   WHERE baggage.baggage_id = sections.contained_baggage_id
                        AND shelves.is_connex_to_section_id = sections.section_id);
         IF rcnt <= 0 THEN
              exit;
         END IF;
         SELECT baggage.baggage_id, sections.section_id, shelves.shelf_id INTO v_stock
         FROM baggage, sections, shelves
         WHERE baggage.baggage_id = sections.contained_baggage_id
              AND shelves.is_connex_to_section_id = sections.section_id
              AND ROWNUM < 2;
         UPDATE sections SET contained_baggage_id = NULL WHERE section_id = v_stock.baggage_id;
         commit; -- do I need that?
    end loop;
    END;
    /So, is there a way to traverse a list of results from a complex query? Maybe without creating a temporary table (or is that the better way?).
    regards, Alex
    I reformatted the code
    pktm

    Ok, here are the details:
    The tables are used to model kind of a transport system. There are terminals connected with sections that may contain 1 piece of baggage. The baggage is moved by a procedure through a transport system. After each of these "moving steps", I check if the baggage is in front of the shelf it should be in.
    [To be honest, the give statement doesn't contain the info, in which shelf the baggage wil bee inserted. That was spared out because of the lack of a working piece of code :)]
    But: if we consider the fact, that a baggage is in front of such a shelf in the way, that it should be put in this shelf, then all this makes some sense.
    - move baggae through a transport system
    - see if you can put baggage into a shelf
    In order to "put baggage in a shelf", I need to remove it from the transport section. As the transport system is not normalized, I need to update the section where the baggage was in.
    Uhm... yes it's a task that doesn't make too much sense. It seems to be some kind of general spirit in university homework :)
    But: the FOR r IN (Statement) lloks good. I'll use that.
    And, the ROWNUM < 2 is used to limit the size of the result to 1, there is no need to have a specific ordering. It's just because - afaik - oracle doesn't have a limit clause. I would appreciate your help if you know a better way to do limit resultsets.
    best regards, Alex

  • Multiple Quizzes with multiple results (in Captivate 6)

    Hey guys, Thanks for reading!
    Does anyone know if it is possible to do multiple tests with multiple results in captivate 6? or if it is possible to have a pre-test with a quiz, and have separate results for each?
    I've been having a play with captivate 6 and when I put a quiz in, it overrides the results slide for my pre-test.
    Looking at the results slide master properties I can choose to have results for one of my quizzes but not both (even on separate slides):
    It wont even let me insert another slide based on the other result.
    I would like to know if multiple quizzes with multiple results is possible in Captivate 6?, or if I am simply doing something wrong?
    Thanks!

    Sorry for way-late reply...
    It's really more how your LMS handles 'courses' and the terminology it uses.
    Essentially, most often, a 'SCORM Package' (SCO) is a 'course'. I'd rather call each SCO a 'lesson' as, to me, 'courses' should be setup in the LMS with a series of 'Lessons'.
    Regardless of the terminology, each 'SCO' is launched by the LMS and one score can be recorded for it via SCORM.
    So if you need multiple final scores recorded, each of those final scores need to be in their own SCO.
    A common approach is a Pre-Test SCO (or 'lesson', or 'course', whatever term), a 'Content' SCO perhaps with some interspersed scored interactions, and a Post-Test SCO...all three merged together as a 'course' (or whatever term) within the LMS.
    That said, as said, it really all depends on how your LMS handles various SCOs...
    Clear as mud?
    E

  • Constructing test with multiple results

    Hi, I have the question for Lilybyri:
    I learn to construct test with multiple results from your article:
    Constructing Test with Multiple Results (CP5)
    This is exactly what I need. My question is - can I use the radio button interaction or smart shape instead click box? What you recommend? I use CP7 or CP8.
    Need to publishing the final test both HTML5 and SWF output. My test wil have 55 questions and 4 results score - one of them describe the personality of learner.
    Yarik

    Advasntage of click box and shape button is that they can have score
    attached to it. That is not the case for radio buttons interaction that has
    also limited formatting options.

  • Target Spry RowID on page with Multiple data sets from another page

    Hi all,
    I am trying to target a specific data item, on a page with
    multiple data sets, from a link on another page. (I also have to
    pass the link through Flash, but lets start with the simple
    part...)
    You can take a look at the site in progress here:
    http://www.3andband.com/TestSite/iframeTest3.html
    From the Home page I want to link to specific news or concert
    items on the News page
    I have been trying to get SpryURLUtils to do it but I can't
    seem to get it working.
    Any help would be greatly appreciated.
    Thanks!
    Ben

    did u try if it even passes the row value?? with a simple
    alert? alert(params.row)
    Also maby u need to reorder the scripts to this;
    <script src="../SpryAssets/SpryURLUtils.js"
    type="text/javascript"></script>
    <script src="../SpryAssets/xpath.js"
    type="text/javascript"></script>
    <script src="../SpryAssets/SpryData.js"
    type="text/javascript"></script>
    <script src="../SpryAssets/SpryCollapsiblePanel.js"
    type="text/javascript"></script>
    <script src="../SpryAssets/SpryEffects.js"
    type="text/javascript"></script>
    <script src="../SpryAssets/SpryAccordion.js"
    type="text/javascript"></script>
    and your js script
    var params = Spry.Utils.getLocationParamsAsObject();
    var dsConcerts = new
    Spry.Data.XMLDataSet("includes/concerts.xml", "Concerts/concert");
    dsConcerts.setColumnType("image", "image");
    var dsNews = new Spry.Data.XMLDataSet("includes/news.xml",
    "News/item");
    //Set an observer so that when the data is loaded, we update
    the current row to the url param value
    dsNews.addObserver({ onPostLoad: function(ds, type) {
    dsNews.setCurrentRow(params.row); }
    function MM_effectBlind(targetElement, duration, from, to,
    toggle)
    Spry.Effect.DoBlind(targetElement, {duration: duration,
    from: from, to: to, toggle: toggle});
    So url params get loaded before the data

  • Callable Statatement returning multiple Result Sets

    Hello all,
    I've got a stored procedure that will be returning multiple result sets and i was wondering if someone could show me how to pull the multiple result sets out of the CallableStatement object. Any help would be greatly appreciated.

    Here is a sample that does what you want. You will have to substitute the call to DBConn.getConnection() with your own DB connection. Also remove the import of com.ovotron.util.*.import com.ovotron.util.*;
    import java.sql.*;
    public class MultiSQL {
        private static Connection conn = null;
        public static void main(String[] args) {
            // Just gets a connection to the DB.
            conn = DBConn.getConnection();
            getResults(conn);
        * Cycles through multiple result sets returned from a stored procedure.
        * Only the first column is output.
        * <p>
        private static void getResults(Connection conn) {
            // Not sure which DBMS you are using. This is the syntax for
            // SQLServer V7.0.
            String            sql     = "{call getMultiResults}";
            CallableStatement stmt    = null;
            ResultSet         rs      = null;
            int               setNo   = 0;
            try {
                stmt = conn.prepareCall(sql);
                boolean found = stmt.execute();
                while (found) {
                    setNo++;
                    rs = stmt.getResultSet();
                    while (rs.next()) {
                        System.out.println("Result set " + setNo +
                                           ": value: " + rs.getString(1));
                        System.out.flush();
                    rs.close();
                    found = stmt.getMoreResults();
            catch (SQLException e) {
                e.printStackTrace();
            finally {
                try {
                    if (rs   != null) rs.close();
                    if (stmt != null) stmt.close();
                catch (SQLException e) {
                    // Tried already to clean up.
    }The procedure I used is:CREATE PROCEDURE [getMultiResults] AS
    select  col1 from tab1;
    select col2 from tab1;
    select col3 from tab1;Of course you will need to create and populate tab1.

  • Help with streaming result sets and prepared statements

    hi all
    I create a callable statement that is capable of streaming.
    statement = myConn2.prepareCall("{call graphProc(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}",java.sql.ResultSet.TYPE_FORWARD_ONLY,
    java.sql.ResultSet.CONCUR_READ_ONLY);
    statementOne.setFetchSize(Integer.MIN_VALUE);
    the class that contains the query is instantiated 6 times the first class streams the results beautifully and then when the second
    rs = DatabaseConnect.statementOne.executeQuery();
    is executed I get the following error
    java.sql.SQLException: Can not use streaming results with multiple result statements
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
    at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:1370)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1688)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:3031)
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:943)
    at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1049)
    at com.mysql.jdbc.CallableStatement.executeQuery(CallableStatement.java:589)
    the 6 instances are not threaded and the result set is closed before the next query executes is there a solution to this problem it would be greatly appreciated
    thanks a lot
    Brian

    Database resources should have the narrowed scope
    possible. I don't think it's a good idea to use a
    ResultSet in a UI to generate a graph. Load the data
    into an object or data structure inside the method
    that's doing the query and close the ResultSet in a
    finally block. Use the data structure to generate
    the graph.
    It's an example of MVC and layering.
    Ok that is my bad for not elaborating on the finer points sorry, the results are not directly streamed into the graphs from the result set. and are processed in another object and then plotted from there.
    with regards to your statement in the beginning I would like to ask if you think it at least a viable option to create six connections. with that said would you be able to give estimated users using the six connections under full usage.
    just a few thoughts that I want to
    bounce off you if you don't mind. Closing the
    statement would defeat the object of of having a
    callable statement How so? I don't agree with that.
    %again I apologise I assumed that since callable statements inherit from prepared statements that they would have the pre compiled sql statement functionality of prepared statements,well If you consider in the example I'm about to give maybe you will see my point at least with regards to this.
    The statement that I create uses a connection and is created statically at the start of the program, every time I make a call the same statement and thus connection is used, creating a new connection each time takes up time and resources. and as you know every second counts
    thanks for your thoughts
    Brian.

  • Multiple result sets from stored procedure into CachedRowSet

    How can you obtain multiple sets of data from a stored procedure that returns multiple result sets, when you'd like to use CachedRowSet rather than ResultSet?
    My database's stored procedures return multiple result sets, but I'm not sure how to manipulate that using CallableStatements and CachedRowSets... I read the RowSet tutorial from java.sun.com but that didn't cover the case of multiple result sets and CallablStatements.
    How might I do this? Thanks a lot.

    SELECT columns..
    FROM table
    FOR XML PATH('NodeName'),('Rootname')
    Thank you for replying.
    I dont have to generate XML from a query. I have to generate from a SP and that too without modifying it.
    Thanks,
    Tauhid
    thats ok you can do like this
    1. Create a table with structure same as SP resultset
    2. Populate table with SP result as per below
    INSERT table
    EXEC SPName param1value,...
    3. Add a query like below
    SELECT columns..
    FROM tablename
    FOR XML PATH('NodeName'),('RootName')
    see
    http://visakhm.blogspot.com/2014/05/t-sql-tips-fun-with-for-xml-path.html
    4. Use sp_send_dbmail to sent it through mail
    http://msdn.microsoft.com/en-IN/library/ms190307.aspx
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Handling Multiple Result Sets

    Hi
    I have a problem while handling multiple result sets. To fix that problem i need to upgrade my JDBC version2.0 to 4.0.
    My Problem is that i dont know which jars need to be downloaded to upgrade my JDBC version.

    Mallika_23 wrote:
    Is that any more ideas ???1. Learn how google works.
    2. Find the drivers
    3. Read the documentation
    4. Ask questions here once you have actually read the documentation.

Maybe you are looking for

  • Can I restore from Time Machine backup after replacing hard drive

    I'm planning on replacing the 250GB hard drive in my mid 2010 13 inch MBP with a larger one. My MBP comes with Snow Leopard, and I've installed Lion and recently Mountain Lion from App Store. Can I use my Snow Leopard disc to boot up the laptop after

  • EP 7 : Integration with ADS & ABAP engine

    Dear All, I am installing EP 7 with ABAP engine. In this case, the J2EE engine will be installed as an add-in. In this case, the UME configuration of EP will use the SAP ABAP engine as datasource. Now, will I be able to integrate my EP , UME with the

  • Scrollpane, ScrollDrag and buttons

    I think I already know the answer to this question but I thought I'd ask just to be sure.  I have a scollpane loaded and I have buttons in the content( a map) thats loaded in the scrollpane.  The buttons work fine until I try to turn on scrolldrag. 

  • Mp3 Burning issue

    I have created a play list i want burnt. I select all ones i want burnt onto a CD-R tal amount less than disk size About 680mb. Seems burn ok then at end of it it says something like "Autoplay Error -50" some music appears be on it and plays little b

  • FM/BAPI/BADI  to create Request For Proposal from Puchase Requisition?

    Can somebody suggest me some some function Modules, BAPI's or BADI's to create a RFP from Purchase Requisition?????????