ResultSet size

Hi all,
Is there any simple way to get the number of rows in a ResultSet object before iterating it? Right now I have to iterate it the ResultSet object first and then I can determine the rows....
Is there any faster method?
Thanks.

Why do you need the count?
[Standard pre-packaged copy&pasted rant follows]
The really really best way to know the number of rows in a ResultSet: write your application so that you don't need to know it.
To get the number of rows in a ResultSet, loop over the result set with while(res.next()). Read each row into an object. Add each object into e.g. a LinkedList. At the end, you will have the rows nicely converted to objects (which you usually should do anyway). And list.size() will give the number of objects. This is a common reason why people ask about it: they want to read the rows into an array. Do yourself, your computer, and your database server a favor and use a LinkedList or some other Collection instead of an array. If you must have an array read into a LinkedList and convert that into an array at the end.
There are other ways to get the number of objects, but list.size() is the easy and reliable way. If you don't need the rows converted to objects ...why did you select them in the first place?
Tricks with last()/getRow() sort of work. They read the entire result set into memory (in a memory-inefficient way: the storage that scrollable result sets take is almost certainly more than "real" objects). But you'll need to write the while(res.next()) loop anyway. No point in having the computer do the same thing twice. So last()/getRow() is inefficient and just plain extra silly work.
Still thinking of using last()/getRow()? Bad idea. When you execute a select, the database server doesn't necessarily even know the number of rows you selected (the cursor "materializes" as it is being read). The server will hand rows to the JDBC driver, without being able to tell in advance how many there will be. So the only way getRow() can know how many rows there are is by reading in all of the rows. This consumes time and memory. And you STILL have to write the while(res.next()) loop, so the computer is doing the same work twice and you are writing extra code. And not all databases and drivers support last()/getRow() so you'll be making your code vendor dependent.
"select count(*) from ..." is another way, but it has a few problems: (1) The query gets executed twice, so it is almost twice as slow. (2) The number of rows can change between the two queries. (3) You'll need to write the while(res.next()) loop anyway, so you'll be doing silly useless extra coding work.
Best Practice: stop needing the number of rows.
Second Best Practice: while(res.next()), create objects, put into a LinkedList, use list.size().
Silly Extra Work And Slowness: last()/getRow() or select count(*).
Now for a bit of backpedaling -- what I told you above isn't necessarily true in every situation:
There may be situations where last()/lastRow() may be reasonable. You need to know how your database implements them and understand the performance implications. The more rows your ResultSet has the worse last()/lastRow() will perform. Try the easier solutions first: stop needing the count, or use a Collection.
There is a related question that people are sometimes working on when they ask the number-of-rows question: how do I page database results. That may require "select count(*)" or something, depending on how you want to do it. There is no really perfect universal solution for that question using plain SQL. (As an aside: paging is also hard to do really well in SQL, as you need to sort the results - if you have a large result set this can be slow. There are things like ROWCOUNT or LIMIT in some databases but for those to make sense there has to be an ORDER BY for the full result set.)
How does Google know the count so it can display "Results 1 - 10 of about 2,290,000 for rhubarb"? By not using an SQL database.

Similar Messages

  • How to find size of ResultSet in JAVA

    hi ,
    I have one problem... went for sun API but i did not get any solution....please any body help me... my problem is ......
    I got the data from DataBase by executing a query . so my Resultset having some records.Now my problem is how to find the size of ResultSet.without converting into list or without wile loop I want to find out size of my ResultSet
    ..... Is there any predefined method for that;
    thanks in advance

    gbabu wrote:
    hay.... again you are diverting from topic. my problem is how to find resultset size.... not for how to write query for counting records.Of cousre he is. Because the answer to your question is: it can't be done. So he's kindly moved on, and offered you an alternative way to achieve what you want. If that offends you, I suggest you have your head in an uncomfortable and unsuitable orifice
    Why are you so desperate to know the size of the ResultSet anyway? If you've got limits on the size of ResultSet that's acceptable, you can adjust your query to limit the number of rows returned. if you simply need to know how many rows there are, pulling the entire content of the table(s) back and counting them afterwards is horrifically inefficient. If you need to know to so you can prepare a datastructure to put the results in, maybe you've chosen the wrong structure (I'm thinking 'array' here). You might have a legitimate reason to find out the size of a ResultSet, I don't know. But the ResultSet interface doesn't give you that option, so you're on a hiding to nothing, and might as well use the suggested alternative, or reconsider your requirement

  • Bad performance with many xmlqueries in select and big resultset

    I'm running into big performance problems with the following query (edited the query a bit to remove sensitive information):
    SELECT id "id",created "created",
      xmlcast(xmlquery('declare default element namespace "http://www.example.com/myproject/schema/namespace2";declare namespace c="http://www.example.com/myproject/schema/common";/element1/element2/name' passing xml returning content) as varchar2(182))"element2Name",
      xmlcast(xmlquery('declare default element namespace "http://www.example.com/myproject/schema/namespace2";declare namespace c="http://www.example.com/myproject/schema/common";/element1/element3/name' passing xml returning content) as varchar2(182))"element3Name",
      xmlcast(xmlquery('declare default element namespace "http://www.example.com/myproject/schema/namespace2";declare namespace c="http://www.example.com/myproject/schema/common";/element1/ror/gcor' passing xml returning content) as varchar2(5))"gcor",
      xmlcast(xmlquery('declare default element namespace "http://www.example.com/myproject/schema/namespace2";declare namespace c="http://www.example.com/myproject/schema/common";/element1/c:element1Header/c:status/c:cStatus' passing xml returning content) as integer)"cStatus",
      xmlcast(xmlquery('declare default element namespace "http://www.example.com/myproject/schema/namespace2";declare namespace c="http://www.example.com/myproject/schema/common";/element1/c:element1Header/c:status/c:lrrm' passing xml returning content) as integer)"lrrm",
      xmlcast(xmlquery('declare default element namespace "http://www.example.com/myproject/schema/namespace2";declare namespace c="http://www.example.com/myproject/schema/common";/element1/c:element1Header/c:status/c:sent' passing xml returning content) as integer)"sent",
      xmlcast(xmlquery('declare default element namespace "http://www.example.com/myproject/schema/namespace2";declare namespace c="http://www.example.com/myproject/schema/common";/element1/c:element1Header/c:status/c:success' passing xml returning content) as integer)"success",
      xmlcast(xmlquery('declare default element namespace "http://www.example.com/myproject/schema/namespace2";declare namespace c="http://www.example.com/myproject/schema/common";/element1/c:element1Header/c:status/c:processStep' passing xml returning content) as integer)"processStep",
      xmlcast(xmlquery('declare default element namespace "http://www.example.com/myproject/schema/namespace2";declare namespace c="http://www.example.com/myproject/schema/common";/element1/header/status/aseod' passing xml returning content) as number(1))"aseod",
      xmlcast(xmlquery('declare default element namespace "http://www.example.com/myproject/schema/namespace2";declare namespace c="http://www.example.com/myproject/schema/common";/element1/submission/deferred' passing xml returning content) as number(1))"deferred",
      xmlcast(xmlquery('declare default element namespace "http://www.example.com/myproject/schema/namespace2";declare namespace c="http://www.example.com/myproject/schema/common";/element1/header/status/eventReportReceived' passing xml returning content) as number(1))"eventReports",
      xmlcast(xmlquery('declare default element namespace "http://www.example.com/myproject/schema/namespace2";declare namespace c="http://www.example.com/myproject/schema/common";/element1/c:element1Header/c:status/c:isOpen' passing xml returning content) as number(1))"isOpen",
      xmlcast(xmlquery('declare default element namespace "http://www.example.com/myproject/schema/namespace2";declare namespace c="http://www.example.com/myproject/schema/common";/element1/c:element1Header/c:hasNotes' passing xml returning content) as number(1))"hasNotes"
    FROM tablename,xmltable(xmlnamespaces(default 'http://www.example.com/myproject/schema/namespace2','http://www.example.com/myproject/schema/common' as "c"),'/element1' passing xml columns
    created timestamp path 'c:element1Header/c:creationTime/text()',
    organization_id integer path 'c:element1Header/c:organization/c:organizationId/text()',
    is_sender number(1) path 'c:element1Header/c:isSender/text()')
    WHERE organization_id = 5 AND is_sender = 1 AND created >= sysdate-20 AND created <= sysdate+1;This query is fast as long as the results is small (<1000), but when the resultset grows bigger, the performance seems to decrease exponentially. The cause of this slowdown seems to be in the xmlqueries; commenting out the xmlqueries makes the query very fast again (in the order of a few seconds), even with a 15000+ resultset, while including the xmlqueries makes the query take many minutes.
    Workaround I tried: using a rownum < 1000 works fairly well, but only if I don't use order by (which is required). order by forces the resultset to be full built regardless of the rownum limit. (this was done with a subquery orderby and a rownum on the superquery)
    Other workaround i tried: Having the subquery only return the xml column, and doing the xmlqueries in the superquery. I couldn't get this to work, something about no longer having a key-preserved table.
    Background info about the database: Oracle 11.2.0.3.0, binary xmltype column, with a xmlindex unstructured component on all paths in this query, and a structured component with secondary indexes on the paths used in the WHERE (created, organization_id and is_sender). Database has about 140k records total.
    My question is, if anyone knows if this xmlquery bottleneck can be remedied somehow?
    Addition: graph i made indicating the performance at different resultset sizes. Horizontal axis is size of resultset, vertical axis is time spent in seconds: http://i.imgur.com/F2tyg.png

    Just count(*), nothing else in the select:
    COUNT(*)              
    15432                 
    Plan hash value: 1584286506
    | Id  | Operation                      | Name                  | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT               |                       |     1 |    39 |    31   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE                |                       |     1 |    39 |            |          |
    |*  2 |   FILTER                       |                       |       |       |            |          |
    |   3 |    NESTED LOOPS                |                       |    15 |   585 |    31   (0)| 00:00:01 |
    |   4 |     TABLE ACCESS BY INDEX ROWID| TABLENAME_SC          |    15 |   405 |    16   (0)| 00:00:01 |
    |*  5 |      INDEX RANGE SCAN          | TABLENAME_SC_SUB_IX   |    15 |       |     3   (0)| 00:00:01 |
    |   6 |     TABLE ACCESS BY USER ROWID | TABLENAME             |     1 |    12 |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - filter(SYSDATE@!-500<=SYSDATE@!-50)
       5 - access("SYS_SXI_0"."ORGANIZATION_ID"=6 AND "SYS_SXI_0"."IS_SENDER"=1 AND
                  "SYS_SXI_0"."CREATION_TIME">=SYSDATE@!-500 AND "SYS_SXI_0"."CREATION_TIME"<=SYSDATE@!-50)Original query with ORDER BY on 2 structured component columns, 1 descending and 1 ascending (NOTE: While the explain plan says the time is 00:00:01, the query takes 763 seconds to complete)
    | Id  | Operation                      | Name                           | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT               |                                |    15 | 23880 |    32   (4)| 00:00:01 |
    |   1 |  SORT GROUP BY                 |                                |     1 |    41 |            |          |
    |*  2 |   TABLE ACCESS BY INDEX ROWID  | SYS63339_TABL_XML_I_PATH_TABLE |    17 |   697 |     5   (0)| 00:00:01 |
    |*  3 |    INDEX RANGE SCAN            | SYS63339_TABL_XML_I_PIKEY_IX   |    17 |       |     3   (0)| 00:00:01 |
    |   4 |  SORT GROUP BY                 |                                |     1 |    41 |            |          |
    |*  5 |   TABLE ACCESS BY INDEX ROWID  | SYS63339_TABL_XML_I_PATH_TABLE |    16 |   656 |     5   (0)| 00:00:01 |
    |*  6 |    INDEX RANGE SCAN            | SYS63339_TABL_XML_I_PIKEY_IX   |    16 |       |     3   (0)| 00:00:01 |
    |   7 |  SORT GROUP BY                 |                                |     1 |    41 |            |          |
    |*  8 |   TABLE ACCESS BY INDEX ROWID  | SYS63339_TABL_XML_I_PATH_TABLE |    15 |   615 |     4   (0)| 00:00:01 |
    |*  9 |    INDEX RANGE SCAN            | SYS63339_TABL_XML_I_PIKEY_IX   |    15 |       |     3   (0)| 00:00:01 |
    |  10 |  SORT GROUP BY                 |                                |     1 |    41 |            |          |
    |* 11 |   TABLE ACCESS BY INDEX ROWID  | SYS63339_TABL_XML_I_PATH_TABLE |    17 |   697 |     5   (0)| 00:00:01 |
    |* 12 |    INDEX RANGE SCAN            | SYS63339_TABL_XML_I_PIKEY_IX   |    17 |       |     3   (0)| 00:00:01 |
    |  13 |  SORT GROUP BY                 |                                |     1 |    41 |            |          |
    |* 14 |   TABLE ACCESS BY INDEX ROWID  | SYS63339_TABL_XML_I_PATH_TABLE |    17 |   697 |     5   (0)| 00:00:01 |
    |* 15 |    INDEX RANGE SCAN            | SYS63339_TABL_XML_I_PIKEY_IX   |    17 |       |     3   (0)| 00:00:01 |
    |  16 |  SORT GROUP BY                 |                                |     1 |    41 |            |          |
    |* 17 |   TABLE ACCESS BY INDEX ROWID  | SYS63339_TABL_XML_I_PATH_TABLE |    17 |   697 |     5   (0)| 00:00:01 |
    |* 18 |    INDEX RANGE SCAN            | SYS63339_TABL_XML_I_PIKEY_IX   |    17 |       |     3   (0)| 00:00:01 |
    |  19 |  SORT GROUP BY                 |                                |     1 |    41 |            |          |
    |* 20 |   TABLE ACCESS BY INDEX ROWID  | SYS63339_TABL_XML_I_PATH_TABLE |    17 |   697 |     5   (0)| 00:00:01 |
    |* 21 |    INDEX RANGE SCAN            | SYS63339_TABL_XML_I_PIKEY_IX   |    17 |       |     3   (0)| 00:00:01 |
    |  22 |  SORT GROUP BY                 |                                |     1 |    41 |            |          |
    |* 23 |   TABLE ACCESS BY INDEX ROWID  | SYS63339_TABL_XML_I_PATH_TABLE |    17 |   697 |     5   (0)| 00:00:01 |
    |* 24 |    INDEX RANGE SCAN            | SYS63339_TABL_XML_I_PIKEY_IX   |    17 |       |     3   (0)| 00:00:01 |
    |  25 |  SORT GROUP BY                 |                                |     1 |    41 |            |          |
    |* 26 |   TABLE ACCESS BY INDEX ROWID  | SYS63339_TABL_XML_I_PATH_TABLE |     1 |    41 |     4   (0)| 00:00:01 |
    |* 27 |    INDEX RANGE SCAN            | SYS63339_TABL_XML_I_PIKEY_IX   |     1 |       |     3   (0)| 00:00:01 |
    |  28 |  SORT GROUP BY                 |                                |     1 |    41 |            |          |
    |* 29 |   TABLE ACCESS BY INDEX ROWID  | SYS63339_TABL_XML_I_PATH_TABLE |     8 |   328 |     4   (0)| 00:00:01 |
    |* 30 |    INDEX RANGE SCAN            | SYS63339_TABL_XML_I_PIKEY_IX   |     8 |       |     3   (0)| 00:00:01 |
    |  31 |  SORT GROUP BY                 |                                |     1 |    41 |            |          |
    |* 32 |   TABLE ACCESS BY INDEX ROWID  | SYS63339_TABL_XML_I_PATH_TABLE |     1 |    41 |     4   (0)| 00:00:01 |
    |* 33 |    INDEX RANGE SCAN            | SYS63339_TABL_XML_I_PIKEY_IX   |     1 |       |     3   (0)| 00:00:01 |
    |  34 |  SORT GROUP BY                 |                                |     1 |    41 |            |          |
    |* 35 |   TABLE ACCESS BY INDEX ROWID  | SYS63339_TABL_XML_I_PATH_TABLE |    17 |   697 |     5   (0)| 00:00:01 |
    |* 36 |    INDEX RANGE SCAN            | SYS63339_TABL_XML_I_PIKEY_IX   |    17 |       |     3   (0)| 00:00:01 |
    |  37 |  SORT ORDER BY                 |                                |    15 | 23880 |    32   (4)| 00:00:01 |
    |* 38 |   FILTER                       |                                |       |       |            |          |
    |  39 |    NESTED LOOPS                |                                |    15 | 23880 |    31   (0)| 00:00:01 |
    |  40 |     TABLE ACCESS BY INDEX ROWID| TABLENAME_SC                   |    15 |  1350 |    16   (0)| 00:00:01 |
    |* 41 |      INDEX RANGE SCAN          | TABLENAME_SC_SUB_IX            |    15 |       |     3   (0)| 00:00:01 |
    |  42 |     TABLE ACCESS BY USER ROWID | TABLENAME                      |     1 |  1502 |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - filter(SYS_XMLI_LOC_ISNODE("SYS_P1"."LOCATOR")=1)
       3 - access("SYS_P1"."RID"=:B1 AND "SYS_P1"."PATHID"=HEXTORAW('509D') )
       5 - filter(SYS_XMLI_LOC_ISNODE("SYS_P3"."LOCATOR")=1)
       6 - access("SYS_P3"."RID"=:B1 AND "SYS_P3"."PATHID"=HEXTORAW('4FDE') )
       8 - filter(SYS_XMLI_LOC_ISNODE("SYS_P5"."LOCATOR")=1)
       9 - access("SYS_P5"."RID"=:B1 AND "SYS_P5"."PATHID"=HEXTORAW('7129') )
      11 - filter(SYS_XMLI_LOC_ISNODE("SYS_P7"."LOCATOR")=1)
      12 - access("SYS_P7"."RID"=:B1 AND "SYS_P7"."PATHID"=HEXTORAW('73C0') )
      14 - filter(SYS_XMLI_LOC_ISNODE("SYS_P9"."LOCATOR")=1)
      15 - access("SYS_P9"."RID"=:B1 AND "SYS_P9"."PATHID"=HEXTORAW('3092') )
      17 - filter(SYS_XMLI_LOC_ISNODE("SYS_P11"."LOCATOR")=1)
      18 - access("SYS_P11"."RID"=:B1 AND "SYS_P11"."PATHID"=HEXTORAW('30AA') )
      20 - filter(SYS_XMLI_LOC_ISNODE("SYS_P13"."LOCATOR")=1)
      21 - access("SYS_P13"."RID"=:B1 AND "SYS_P13"."PATHID"=HEXTORAW('3415') )
      23 - filter(SYS_XMLI_LOC_ISNODE("SYS_P15"."LOCATOR")=1)
      24 - access("SYS_P15"."RID"=:B1 AND "SYS_P15"."PATHID"=HEXTORAW('4972') )
      26 - filter(SYS_XMLI_LOC_ISNODE("SYS_P17"."LOCATOR")=1)
      27 - access("SYS_P17"."RID"=:B1 AND "SYS_P17"."PATHID"=HEXTORAW('745F') )
      29 - filter(SYS_XMLI_LOC_ISNODE("SYS_P19"."LOCATOR")=1)
      30 - access("SYS_P19"."RID"=:B1 AND "SYS_P19"."PATHID"=HEXTORAW('6BA9') )
      32 - filter(SYS_XMLI_LOC_ISNODE("SYS_P21"."LOCATOR")=1)
      33 - access("SYS_P21"."RID"=:B1 AND "SYS_P21"."PATHID"=HEXTORAW('62DB') )
      35 - filter(SYS_XMLI_LOC_ISNODE("SYS_P23"."LOCATOR")=1)
      36 - access("SYS_P23"."RID"=:B1 AND "SYS_P23"."PATHID"=HEXTORAW('1FD9') )
      38 - filter(SYSDATE@!-500<=SYSDATE@!-50)
      41 - access("SYS_SXI_0"."ORGANIZATION_ID"=6 AND "SYS_SXI_0"."IS_SENDER"=1 AND
                  "SYS_SXI_0"."CREATION_TIME">=SYSDATE@!-500 AND "SYS_SXI_0"."CREATION_TIME"<=SYSDATE@!-50)
    Note
       - Unoptimized XML construct detected (enable XMLOptimizationCheck for more information)The same query with ORDER BY only on CREATED DESC (takes 15 seconds to complete):
    | Id  | Operation                      | Name                           | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT               |                                |    15 | 23880 |    31   (0)| 00:00:01 |
    |   1 |  SORT GROUP BY                 |                                |     1 |    41 |            |          |
    |*  2 |   TABLE ACCESS BY INDEX ROWID  | SYS63339_TABL_XML_I_PATH_TABLE |    17 |   697 |     5   (0)| 00:00:01 |
    |*  3 |    INDEX RANGE SCAN            | SYS63339_TABL_XML_I_PIKEY_IX   |    17 |       |     3   (0)| 00:00:01 |
    |   4 |  SORT GROUP BY                 |                                |     1 |    41 |            |          |
    |*  5 |   TABLE ACCESS BY INDEX ROWID  | SYS63339_TABL_XML_I_PATH_TABLE |    16 |   656 |     5   (0)| 00:00:01 |
    |*  6 |    INDEX RANGE SCAN            | SYS63339_TABL_XML_I_PIKEY_IX   |    16 |       |     3   (0)| 00:00:01 |
    |   7 |  SORT GROUP BY                 |                                |     1 |    41 |            |          |
    |*  8 |   TABLE ACCESS BY INDEX ROWID  | SYS63339_TABL_XML_I_PATH_TABLE |    15 |   615 |     4   (0)| 00:00:01 |
    |*  9 |    INDEX RANGE SCAN            | SYS63339_TABL_XML_I_PIKEY_IX   |    15 |       |     3   (0)| 00:00:01 |
    |  10 |  SORT GROUP BY                 |                                |     1 |    41 |            |          |
    |* 11 |   TABLE ACCESS BY INDEX ROWID  | SYS63339_TABL_XML_I_PATH_TABLE |    17 |   697 |     5   (0)| 00:00:01 |
    |* 12 |    INDEX RANGE SCAN            | SYS63339_TABL_XML_I_PIKEY_IX   |    17 |       |     3   (0)| 00:00:01 |
    |  13 |  SORT GROUP BY                 |                                |     1 |    41 |            |          |
    |* 14 |   TABLE ACCESS BY INDEX ROWID  | SYS63339_TABL_XML_I_PATH_TABLE |    17 |   697 |     5   (0)| 00:00:01 |
    |* 15 |    INDEX RANGE SCAN            | SYS63339_TABL_XML_I_PIKEY_IX   |    17 |       |     3   (0)| 00:00:01 |
    |  16 |  SORT GROUP BY                 |                                |     1 |    41 |            |          |
    |* 17 |   TABLE ACCESS BY INDEX ROWID  | SYS63339_TABL_XML_I_PATH_TABLE |    17 |   697 |     5   (0)| 00:00:01 |
    |* 18 |    INDEX RANGE SCAN            | SYS63339_TABL_XML_I_PIKEY_IX   |    17 |       |     3   (0)| 00:00:01 |
    |  19 |  SORT GROUP BY                 |                                |     1 |    41 |            |          |
    |* 20 |   TABLE ACCESS BY INDEX ROWID  | SYS63339_TABL_XML_I_PATH_TABLE |    17 |   697 |     5   (0)| 00:00:01 |
    |* 21 |    INDEX RANGE SCAN            | SYS63339_TABL_XML_I_PIKEY_IX   |    17 |       |     3   (0)| 00:00:01 |
    |  22 |  SORT GROUP BY                 |                                |     1 |    41 |            |          |
    |* 23 |   TABLE ACCESS BY INDEX ROWID  | SYS63339_TABL_XML_I_PATH_TABLE |    17 |   697 |     5   (0)| 00:00:01 |
    |* 24 |    INDEX RANGE SCAN            | SYS63339_TABL_XML_I_PIKEY_IX   |    17 |       |     3   (0)| 00:00:01 |
    |  25 |  SORT GROUP BY                 |                                |     1 |    41 |            |          |
    |* 26 |   TABLE ACCESS BY INDEX ROWID  | SYS63339_TABL_XML_I_PATH_TABLE |     1 |    41 |     4   (0)| 00:00:01 |
    |* 27 |    INDEX RANGE SCAN            | SYS63339_TABL_XML_I_PIKEY_IX   |     1 |       |     3   (0)| 00:00:01 |
    |  28 |  SORT GROUP BY                 |                                |     1 |    41 |            |          |
    |* 29 |   TABLE ACCESS BY INDEX ROWID  | SYS63339_TABL_XML_I_PATH_TABLE |     8 |   328 |     4   (0)| 00:00:01 |
    |* 30 |    INDEX RANGE SCAN            | SYS63339_TABL_XML_I_PIKEY_IX   |     8 |       |     3   (0)| 00:00:01 |
    |  31 |  SORT GROUP BY                 |                                |     1 |    41 |            |          |
    |* 32 |   TABLE ACCESS BY INDEX ROWID  | SYS63339_TABL_XML_I_PATH_TABLE |     1 |    41 |     4   (0)| 00:00:01 |
    |* 33 |    INDEX RANGE SCAN            | SYS63339_TABL_XML_I_PIKEY_IX   |     1 |       |     3   (0)| 00:00:01 |
    |  34 |  SORT GROUP BY                 |                                |     1 |    41 |            |          |
    |* 35 |   TABLE ACCESS BY INDEX ROWID  | SYS63339_TABL_XML_I_PATH_TABLE |    17 |   697 |     5   (0)| 00:00:01 |
    |* 36 |    INDEX RANGE SCAN            | SYS63339_TABL_XML_I_PIKEY_IX   |    17 |       |     3   (0)| 00:00:01 |
    |* 37 |  FILTER                        |                                |       |       |            |          |
    |  38 |   NESTED LOOPS                 |                                |    15 | 23880 |    31   (0)| 00:00:01 |
    |  39 |    TABLE ACCESS BY INDEX ROWID | TABLENAME_SC                   |    15 |  1350 |    16   (0)| 00:00:01 |
    |* 40 |     INDEX RANGE SCAN DESCENDING| TABLENAME_SC_SUB_IX            |    15 |       |     3   (0)| 00:00:01 |
    |  41 |    TABLE ACCESS BY USER ROWID  | TABLENAME                      |     1 |  1502 |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - filter(SYS_XMLI_LOC_ISNODE("SYS_P1"."LOCATOR")=1)
       3 - access("SYS_P1"."RID"=:B1 AND "SYS_P1"."PATHID"=HEXTORAW('509D') )
       5 - filter(SYS_XMLI_LOC_ISNODE("SYS_P3"."LOCATOR")=1)
       6 - access("SYS_P3"."RID"=:B1 AND "SYS_P3"."PATHID"=HEXTORAW('4FDE') )
       8 - filter(SYS_XMLI_LOC_ISNODE("SYS_P5"."LOCATOR")=1)
       9 - access("SYS_P5"."RID"=:B1 AND "SYS_P5"."PATHID"=HEXTORAW('7129') )
      11 - filter(SYS_XMLI_LOC_ISNODE("SYS_P7"."LOCATOR")=1)
      12 - access("SYS_P7"."RID"=:B1 AND "SYS_P7"."PATHID"=HEXTORAW('73C0') )
      14 - filter(SYS_XMLI_LOC_ISNODE("SYS_P9"."LOCATOR")=1)
      15 - access("SYS_P9"."RID"=:B1 AND "SYS_P9"."PATHID"=HEXTORAW('3092') )
      17 - filter(SYS_XMLI_LOC_ISNODE("SYS_P11"."LOCATOR")=1)
      18 - access("SYS_P11"."RID"=:B1 AND "SYS_P11"."PATHID"=HEXTORAW('30AA') )
      20 - filter(SYS_XMLI_LOC_ISNODE("SYS_P13"."LOCATOR")=1)
      21 - access("SYS_P13"."RID"=:B1 AND "SYS_P13"."PATHID"=HEXTORAW('3415') )
      23 - filter(SYS_XMLI_LOC_ISNODE("SYS_P15"."LOCATOR")=1)
      24 - access("SYS_P15"."RID"=:B1 AND "SYS_P15"."PATHID"=HEXTORAW('4972') )
      26 - filter(SYS_XMLI_LOC_ISNODE("SYS_P17"."LOCATOR")=1)
      27 - access("SYS_P17"."RID"=:B1 AND "SYS_P17"."PATHID"=HEXTORAW('745F') )
      29 - filter(SYS_XMLI_LOC_ISNODE("SYS_P19"."LOCATOR")=1)
      30 - access("SYS_P19"."RID"=:B1 AND "SYS_P19"."PATHID"=HEXTORAW('6BA9') )
      32 - filter(SYS_XMLI_LOC_ISNODE("SYS_P21"."LOCATOR")=1)
      33 - access("SYS_P21"."RID"=:B1 AND "SYS_P21"."PATHID"=HEXTORAW('62DB') )
      35 - filter(SYS_XMLI_LOC_ISNODE("SYS_P23"."LOCATOR")=1)
      36 - access("SYS_P23"."RID"=:B1 AND "SYS_P23"."PATHID"=HEXTORAW('1FD9') )
      37 - filter(SYSDATE@!-500<=SYSDATE@!-50)
      40 - access("SYS_SXI_0"."ORGANIZATION_ID"=6 AND "SYS_SXI_0"."IS_SENDER"=1 AND
                  "SYS_SXI_0"."CREATION_TIME">=SYSDATE@!-500 AND "SYS_SXI_0"."CREATION_TIME"<=SYSDATE@!-50)
    Note
       - Unoptimized XML construct detected (enable XMLOptimizationCheck for more information)Removing all XmlQueries from the SELECT and adding 1 of them to the XmlTable in the FROM (full table scan, takes 25 seconds to complete):
    | Id  | Operation                    | Name                           | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT             |                                |  1522 |  2232K| 15515   (3)| 00:03:07 |
    |   1 |  TABLE ACCESS BY INDEX ROWID | TABLENAME_SC                   |     1 |    21 |     2   (0)| 00:00:01 |
    |*  2 |   INDEX RANGE SCAN           | SYS63339_63348_RID_IDX         |     1 |       |     1   (0)| 00:00:01 |
    |   3 |  TABLE ACCESS BY INDEX ROWID | TABLENAME_SC                   |     1 |    32 |     2   (0)| 00:00:01 |
    |*  4 |   INDEX RANGE SCAN           | SYS63339_63348_RID_IDX         |     1 |       |     1   (0)| 00:00:01 |
    |   5 |  TABLE ACCESS BY INDEX ROWID | TABLENAME_SC                   |     1 |    23 |     2   (0)| 00:00:01 |
    |*  6 |   INDEX RANGE SCAN           | SYS63339_63348_RID_IDX         |     1 |       |     1   (0)| 00:00:01 |
    |   7 |  TABLE ACCESS BY INDEX ROWID | TABLENAME_SC                   |     1 |    27 |     2   (0)| 00:00:01 |
    |*  8 |   INDEX RANGE SCAN           | SYS63339_63348_RID_IDX         |     1 |       |     1   (0)| 00:00:01 |
    |   9 |  TABLE ACCESS BY INDEX ROWID | TABLENAME_SC                   |     1 |    18 |     2   (0)| 00:00:01 |
    |* 10 |   INDEX RANGE SCAN           | SYS63339_63348_RID_IDX         |     1 |       |     1   (0)| 00:00:01 |
    |  11 |  TABLE ACCESS BY INDEX ROWID | TABLENAME_SC                   |     1 |    13 |     2   (0)| 00:00:01 |
    |* 12 |   INDEX RANGE SCAN           | SYS63339_63348_RID_IDX         |     1 |       |     1   (0)| 00:00:01 |
    |* 13 |  TABLE ACCESS BY INDEX ROWID | SYS63339_TABL_XML_I_PATH_TABLE |     1 |    37 |     4   (0)| 00:00:01 |
    |* 14 |   INDEX RANGE SCAN           | SYS63339_TABL_XML_I_PIKEY_IX   |    17 |       |     3   (0)| 00:00:01 |
    |* 15 |  FILTER                      |                                |       |       |            |          |
    |* 16 |   TABLE ACCESS FULL          | TABLENAME                      |  1522 |  2232K|  9423   (4)| 00:01:54 |
    |  17 |   TABLE ACCESS BY INDEX ROWID| TABLENAME_SC                   |     1 |    13 |     2   (0)| 00:00:01 |
    |* 18 |    INDEX RANGE SCAN          | SYS63339_63348_RID_IDX         |     1 |       |     1   (0)| 00:00:01 |
    |  19 |   TABLE ACCESS BY INDEX ROWID| TABLENAME_SC                   |     1 |    13 |     2   (0)| 00:00:01 |
    |* 20 |    INDEX RANGE SCAN          | SYS63339_63348_RID_IDX         |     1 |       |     1   (0)| 00:00:01 |
    |  21 |   TABLE ACCESS BY INDEX ROWID| TABLENAME_SC                   |     1 |    21 |     2   (0)| 00:00:01 |
    |* 22 |    INDEX RANGE SCAN          | SYS63339_63348_RID_IDX         |     1 |       |     1   (0)| 00:00:01 |
    |  23 |   TABLE ACCESS BY INDEX ROWID| TABLENAME_SC                   |     1 |    21 |     2   (0)| 00:00:01 |
    |* 24 |    INDEX RANGE SCAN          | SYS63339_63348_RID_IDX         |     1 |       |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("SYS_SXI_7"."RID"=:B1)
       4 - access("SYS_SXI_6"."RID"=:B1)
       6 - access("SYS_SXI_5"."RID"=:B1)
       8 - access("SYS_SXI_4"."RID"=:B1)
      10 - access("SYS_SXI_3"."RID"=:B1)
      12 - access("SYS_SXI_2"."RID"=:B1)
      13 - filter(SYS_XMLI_LOC_ISTEXT("SYS_P0"."LOCATOR","SYS_P0"."PATHID")=1)
      14 - access("SYS_P0"."RID"=:B1 AND "SYS_P0"."PATHID"=HEXTORAW('509D') )
      15 - filter(CAST(TO_NUMBER(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL( (SELECT
                  SYS_XQ_PKSQL2XML("SYS_SXI_11"."ORGANIZATION_ID",2,4,2) FROM "USERN"."TABLENAME_SC" "SYS_SXI_11" WHERE
                  "SYS_SXI_11"."RID"=:B1),0,0,54525952,0),50,1,2)) AS integer )=6 AND
                  CAST(TO_NUMBER(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL( (SELECT SYS_XQ_PKSQL2XML("SYS_SXI_10"."IS_SENDER",2,4,2)
                  FROM "USERN"."TABLENAME_SC" "SYS_SXI_10" WHERE "SYS_SXI_10"."RID"=:B2),0,0,54525952,0),50,1,2)) AS
                  number(1) )=1 AND CAST(TO_TIMESTAMP(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL( (SELECT
                  SYS_XQ_PKSQL2XML("SYS_SXI_9"."CREATION_TIME",180,8,2) FROM "USERN"."TABLENAME_SC" "SYS_SXI_9" WHERE
                  "SYS_SXI_9"."RID"=:B3),0,0,20971520,0),50,1,2),'SYYYY-MM-DD"T"HH24:MI:SSXFF') AS timestamp
                  )>=SYSDATE@!-300 AND CAST(TO_TIMESTAMP(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL( (SELECT
                  SYS_XQ_PKSQL2XML("SYS_SXI_8"."CREATION_TIME",180,8,2) FROM "USERN"."TABLENAME_SC" "SYS_SXI_8" WHERE
                  "SYS_SXI_8"."RID"=:B4),0,0,20971520,0),50,1,2),'SYYYY-MM-DD"T"HH24:MI:SSXFF') AS timestamp
                  )<=SYSDATE@!-200)
      16 - filter(EXISTSNODE(SYS_MAKEXML(0,"SYS_ALIAS_11"."SYS_NC00003$"),'/oraxq_defpfx:element1','
                  xmlns:oraxq_defpfx="http://www.example.com/myproject/schema/namespace2"')=1)
      18 - access("SYS_SXI_11"."RID"=:B1)
      20 - access("SYS_SXI_10"."RID"=:B1)
      22 - access("SYS_SXI_9"."RID"=:B1)
      24 - access("SYS_SXI_8"."RID"=:B1)Index creation script:
    CREATE INDEX tabl_xml_ix
      ON tablename(xml)
      INDEXTYPE IS XDB.XMLIndex
      PARAMETERS('
        PATHS (INCLUDE (/element1/common:header/common:kind
    /element1/common:element1Header/common:referenceNumber
    /element1/common:element1Header/common:reference
    /element1/common:element1Header/common:organization/common:organizationId
    /element1/common:element1Header/common:status/common:cStatus
    /element1/common:element1Header/common:status/common:isOpen
    /element1/common:element1Header/common:status/common:processStep
    /element1/common:element1Header/common:status/common:lrrm
    /element1/common:element1Header/common:status/common:sent
    /element1/common:element1Header/common:status/common:success
    /element1/common:element1Header/common:creationTime)
                       NAMESPACE MAPPING (xmlns="http://www.example.com/myproject/schema/namespace2"
                            xmlns:common="http://www.example.com/myproject/schema/common"))');
    ALTER INDEX tabl_xml_ix
    PARAMETERS ('PATHS (INCLUDE ADD (/element1/e/referenceCode
    /element1/e/header/sNumber
    /element1/element2/name
    /element1/element3/name
    /element1/element4/id
    /element1/submission/deferred
    /element1/common:element1Header/common:organization/common:pNumber
    /element1/e/iNumber
    /element1/header/status/aseod
    /element1/common:element1Header/common:isSender
    /element1/ror/gcor
    /element1/header/status/eventReportReceived
    /element1/pod/eNumber)
                       NAMESPACE MAPPING (xmlns="http://www.example.com/myproject/schema/namespace2"
                            xmlns:common="http://www.example.com/myproject/schema/common"))');
    BEGIN
      DBMS_XMLINDEX.registerParameter(
        'tablename_add_sc','ADD_GROUP GROUP tablename_group
    XMLTABLE tablename_sc
    XMLNAMESPACES(
    DEFAULT ''http://www.example.com/myproject/schema/namespace2'',
    ''http://www.example.com/myproject/schema/common'' AS "common"
    ''/element1''
    COLUMNS
    is_sender NUMBER(1) path ''common:element1Header/common:isSender/text()'',
    creation_time TIMESTAMP PATH ''common:element1Header/common:creationTime/text()'',
    rn VARCHAR2(22 CHAR) PATH ''common:element1Header/common:referenceNumber/text()'',
    rc VARCHAR2(21) PATH ''e/referenceCode/text()'',
    reference VARCHAR2(35 CHAR) PATH ''common:element1Header/common:reference/text()'',
    i_nr VARCHAR2(35 CHAR) PATH ''e/iNumber/text()'',
    p_nr VARCHAR2(32) PATH ''common:element1Header/common:organization/common:pNumber/text()'',
    pod_e_nr VARCHAR2(13) PATH ''pod/eNumber/text()'',
    d_id VARCHAR2(16) PATH ''element4/id/text()'',
    organization_id INTEGER PATH ''common:element1Header/common:organization/common:organizationId/text()'',
    sequence_number INTEGER PATH ''e/eHeader/sequenceNumber/text()''
    END;
    ALTER INDEX tabl_xml_ix PARAMETERS('PARAM tablename_add_sc');
    create index tablename_sc_rn_ix on tablename_sc(rn);
    create index tablename_sc_time_ix on tablename_sc(creation_time);
    create index tablename_sc_sub_ix on tablename_sc (organization_id, is_sender, creation_time);Edited by: Michiel Weggen on Apr 11, 2012 2:02 AM Reason: Forgot secondary indexes.
    Edited by: Michiel Weggen on Apr 11, 2012 5:51 AM: changed path of d_id to element4/id in the structured component

  • How do I handle large resultsets in CRXI without a performance issue?

    Hello -
    Problem Definition
    I have a performance problem displaying large/huge resultset of data on a crystal report.  The report takes about 4 minutes or more depending on the resultset size.
    How do you handle large resultsets in Crystal Reports without a performance issue?
    Environment
    Crystal Reports XI
    Apache WebSvr 2.X, Jboss 4.2.3, Struts
    Java Reporting Component (JRC),Crystal Report Viewer (CRV)
    Firefox
    DETAILS
    I use the CRXI thick client to build my report (.rpt) and then use it in my webapplication (webapp) under Jboss.
    User specifies the filter criteria to generate a report (date range etc) and submits the request to the webapp.  Webapp  queries the database, gets a "resultset".
    I initialize the JRC and CRV according to all the specifications and finally call the "processHttpRequest" method of Crystal Report Viewer to display the report on browser.
    So.....
    - Request received to generate a report with a filter criteria
    - Query DB to get resultset
    - Initialize JRC and CRV
    - finally display the report by calling
        reportViewer.processHttpRequest(request, response, request.getSession().getServletContext(), null);
    The performance problem is within the last step.  I put logs everywhere and noticed that database query doesnt take too long to return resultset.  Everything processes pretty quickly till I call the processHttpRequest of CRV.  This method just hangs for a long time before displaying the report on browser.
    CRV runs pretty fast when the resultset is smaller, but for large resultset it takes a long long time.
    I do have subreports and use Crystal report formulas on the reports.  Some of them are used for grouping also.  But I dont think Subreports is the real culprit here.  Because I have some other reports that dont have any subreports, and they too get really slow displaying large resultsets.
    Solutions?
    So obviously I need a good solution to this generic problem of "How do you handle large resultsets in Crystal Reports?"
    I have thought of some half baked ideas.
    A) Use external pagination and fetch data only for the current page being displayed.  But for this, CRXI must allow me to create my own buttons (previous, next, last), so I can control the click event and fetch data accordingly.  I tried capturing events by registering event handler "addToolbarCommandEventListener" of CRV.  But my listener gets invoked "after" processHttpRequest method completes, which doesnt help.
    Some how I need to be able to control the UI by adding my own previous page, next page, last page buttons and controlling it's click events. 
    B) Automagically have CRXI use a javascript functionality, to allow browser side page navigation.  So maybe the first time it'll take 5 mins to display the report, but once it's displayed, user can go to any page without sending the request back to server.
    C) Try using Crystal Reports 2008.  I'm open to using this version, but I couldnt figureout if it has any features that can help me do external pagination or anything that can handle large resultsets.
    D) Will using the Crystal Reports Servers like cache server/application server etc help in any way?  I read a little on the Crystal Page Viewer, Interactive Viewer, Part Viewer etc....but I'm not sure if any of these things are going to solve the issue.
    I'd appreciate it if someone can point me in the right direction.

    Essentialy the answer is use smaller resultsets or pull from the database directly instead of using resultsets.

  • Result Set Too Large : Data Retrieval restricted by configuration

    Hi Guys,
    I get the above error when running a large dataset, with a hierarchy on - but when I run without a hierarchy I am able to show all data.
    The Basis guys increased the ESM buffer (rsdb/esm/buffersize_kb) but it still causes an issue.
    Anyone any ideas when it comes to reporting large volumes with a hierarchy?
    Much appreciated,
    Scott

    Hi there
    I logged a message on service marketplace andg got this reply from SAP:
    ' You might have to increase the value for parameters
    BICS_DA_RESULT_SET_LIMIT_DEF and BICS_DA_RESULT_SET_LIMIT_MAX as it
    seems that the result set is still too large. Please check your
    parameters as to how many data cells you should expect and set the
    parameter accordingly.
    The cells are the number of data points that would be send from abap
    to java. The zero suppression or parts of the result suppression are
    done afterwards. As a consequence of this, the number of displayed
    data cells might differ from the threshold that is effective.
    Starting with SPS 14 you get the information how many data cells are
    rejected. That gives you better ways to determine the right setting.
    Currently you need to raise the number to e.g. 2.000.000 to get all
    data.
    If BICS_DA_RESULT_SET_LIMIT_MAX is set to a lower value than
    BICS_DA_RESULT_SET_LIMIT_DEF, it would automatically cut the value of
    BICS_DA_RESULT_SET_LIMIT_DEF down to its own..
    Please note that altough this parameter can be increased via
    configuration, you should do a proper system sizing according to note
    927530 to ensure that the system can handle the number of users and
    resultset sizes you are expecting."
    Our basis team have subsequently apllied these changes, and I will be testing today.
    Thx

  • Re: not exists SQL using ! filter expression with a variable

    This is still not producing the correct result set in Kodo JDO 3.0.0RC4. I
    see the following SQL statement in the log.
    DEBUG ExecuteThread: '10' for queue: 'default' kodo.jdbc.SQL - <t 7720801,
    conn 5232795> [10 ms] executing prepstmnt 1654874 SELECT DISTINCT t0.pk,
    t0.JDOCLASS, t0.JDOVERSION, t0.AEndPoint, t0.AEndPointType, t0.DS0, t0.DS1,
    t0.DS2, t0.DS3, t0.DS4, t0.ZEndPoint, t0.ZEndPointType, t0.adminState,
    t0.creationDate, t0.speckey, t0.spectype, t0.description,
    t0.lastModifiedDate, t0.lastModifiedUserId, t0.lastupdate, t0.name, t0.note,
    t0.previousVersion, t0.resourceBusinessName, t0.signalType, t0.supporting,
    t0.direction, t0.validForEnd, t0.validForStart FROM dschannel t0 CROSS JOIN
    channelsegment t1 WHERE (NOT (t0.pk = t1.channel AND t0.supporting = ? AND
    (t1.validForEnd > ? OR t1.validForStart < ?))) [params=(String)
    101/DS3/LOC01/LOC02, (Timestamp) 2001-07-24 20:29:14.0, (Timestamp)
    2038-01-18 22:14:07.0]
    INFO ExecuteThread: '10' for queue: 'default' com.metasolv.oss.inventory -
    resultSet size=0
    It looks to me like the CROSS JOIN is not the right join to be using. ---
    unless I am doing something altogether incorrect in the JDO Query itself,
    which is highly likely.
    Ben
    "Ben Eng" <[email protected]> wrote in message news:...
    Using Kodo JDO 2.5.3, I am attempting to do queries of the following form:
    select * from dschannel as c
    where not exists (select pk from channelsegment as s
    where c.pk = s.channel and
    c.supporting = ? and
    (s.validForEnd > ? or
    s.validForStart < ?));
    select * from dschannel as c
    left join channelsegment as s
    on c.pk = s.channel and
    c.supporting = ? and
    (s.validForEnd > ? or
    s.validForStart < ?)
    where s.channel is null;
    The code looks like this:
    extent = pm.getExtent( ChannelValue.class, true );
    query = pm.newQuery( this.extent );
    query.declareImports( "import
    com.metasolv.resources.entity.connection.ChannelSegmentValueImpl; import
    java.util.Date;" );
    query.declareParameters( "String pConn, Date pStart, Date pEnd" );
    query.declareVariables( "ChannelSegmentValueImpl assign" );
    String filter = "! (key == assign.channel && supportingConnection == pConn
    && (assign.validForEnd > pStart || assign.validForStart < pEnd))";
    query.setFilter( filter );
    resultSet = (java.util.Collection) query.execute( connection,
    interval.getStartDateTime(), interval.getEndDateTime() );
    I am seeing the following Exception with mysql 4.0.15 and mysql connector
    JDBC driver 3.0.8:
    com.solarmetric.kodo.runtime.DataStoreException:
    com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper:
    [SQL=SELECT DISTINCT t0.PK, t0.JDOCLASSX, t0.JDOLOCKX, t0.AEndPoint,
    t0.AEndPointType, t0.DS0, t0.DS1, t0.DS2, t0.DS3, t0.DS4, t0.ZEndPoint,
    t0.ZEndPointType, t0.adminState, t0.creationDate, t0.SPECKEY, t0.SPECTYPE,
    t0.description, t0.lastModifiedDate, t0.lastModifiedUserId, t0.LASTUPDATE,
    t0.name, t0.note, t0.previousVersion, t0.resourceBusinessName,
    t0.signalType, t0.supporting, t0.direction, t0.validForEnd,
    t0.validForStart> FROM DSChannel t0 LEFT OUTER JOIN ChannelSegment t1 WHERE NOT (t0.PK => t1.channel AND t0.supporting = '101/DS3/LOC01/LOC02' AND (t1.validForEnd >> {ts '2001-07-24 20:59:49.0' OR t1.validForStart < {ts '2038-01-18
    22:14:07.0'}))]
    [PRE=SELECT DISTINCT t0.PK, t0.JDOCLASSX, t0.JDOLOCKX, t0.AEndPoint,
    t0.AEndPointType, t0.DS0, t0.DS1, t0.DS2, t0.DS3, t0.DS4, t0.ZEndPoint,
    t0.ZEndPointType, t0.adminState, t0.creationDate, t0.SPECKEY, t0.SPECTYPE,
    t0.description, t0.lastModifiedDate, t0.lastModifiedUserId, t0.LASTUPDATE,
    t0.name, t0.note, t0.previousVersion, t0.resourceBusinessName,
    t0.signalType, t0.supporting, t0.direction, t0.validForEnd,
    t0.validForStart> FROM DSChannel t0 LEFT OUTER JOIN ChannelSegment t1 WHERE NOT (t0.PK => t1.channel AND t0.supporting = ? AND (t1.validForEnd > ? ORt1.validForStart> < ?))
    Syntax error or access violation, message from server: "You have an error
    in your SQL syntax. Check the manual that corresponds to your MySQLserver
    version for the right syntax to use near 'WHERE NOT (t0.PK = t1.channelAND
    t0.supporting = '101/DS3/LOC0" [code=1064;state=42000]
    NestedThrowables:
    com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper:
    [SQL=SELECT DISTINCT t0.PK, t0.JDOCLASSX, t0.JDOLOCKX, t0.AEndPoint,
    t0.AEndPointType, t0.DS0, t0.DS1, t0.DS2, t0.DS3, t0.DS4, t0.ZEndPoint,
    t0.ZEndPointType, t0.adminState, t0.creationDate, t0.SPECKEY, t0.SPECTYPE,
    t0.description, t0.lastModifiedDate, t0.lastModifiedUserId, t0.LASTUPDATE,
    t0.name, t0.note, t0.previousVersion, t0.resourceBusinessName,
    t0.signalType, t0.supporting, t0.direction, t0.validForEnd,
    t0.validForStart> FROM DSChannel t0 LEFT OUTER JOIN ChannelSegment t1 WHERE NOT (t0.PK => t1.channel AND t0.supporting = '101/DS3/LOC01/LOC02' AND (t1.validForEnd >> {ts '2001-07-24 20:59:49.0' OR t1.validForStart < {ts '2038-01-18
    22:14:07.0'}))]
    [PRE=SELECT DISTINCT t0.PK, t0.JDOCLASSX, t0.JDOLOCKX, t0.AEndPoint,
    t0.AEndPointType, t0.DS0, t0.DS1, t0.DS2, t0.DS3, t0.DS4, t0.ZEndPoint,
    t0.ZEndPointType, t0.adminState, t0.creationDate, t0.SPECKEY, t0.SPECTYPE,
    t0.description, t0.lastModifiedDate, t0.lastModifiedUserId, t0.LASTUPDATE,
    t> 0.name, t0.note, t0.previousVersion, t0.resourceBusinessName,t0.signalType,> t0.supporting, t0.direction, t0.validForEnd, t0.validForStart FROMDSChannel> t0 LEFT OUTER JOIN ChannelSegment t1 WHERE NOT (t0.PK = t1.channel AND> t0.supporting = ? AND (t1.validForEnd > ? OR t1.validForStart < ?))
    Syntax error or access violation, message from server: "You have an error
    in your SQL syntax. Check the manual that corresponds to your MySQLserver
    version for the right syntax to use near 'WHERE NOT (t0.PK = t1.channelAND
    t0.supporting = '101/DS3/LOC0"
    at
    com.solarmetric.kodo.impl.jdbc.runtime.SQLExceptions.throwDataStore(SQLExcep
    tions.java:64)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.executeQuery(JDBCSto
    reManager.java:1167)
    at
    com.solarmetric.kodo.impl.jdbc.query.JDBCQuery.executeQuery(JDBCQuery.java:1
    26)
    at
    com.solarmetric.kodo.query.QueryImpl$DatastoreQueryExecutor.executeQuery(Que
    ryImpl.java:1565)
    at
    com.solarmetric.kodo.query.QueryImpl$AggregateQueryExecutor.executeQuery(Que
    ryImpl.java:1401)
    at
    com.solarmetric.kodo.query.QueryImpl.executeQueryWithMap(QueryImpl.java:685)
    >
    atcom.solarmetric.kodo.query.QueryImpl.executeWithMap(QueryImpl.java:545)
    >
    at
    com.solarmetric.kodo.query.QueryImpl.executeWithArray(QueryImpl.java:531)
    at com.solarmetric.kodo.query.QueryImpl.execute(QueryImpl.java:513)
    at
    com.metasolv.resources.queries.ChannelAvailabilityQueryBean.execute(ChannelA
    vailabilityQueryBean.java:55)
    at
    com.metasolv.oss.inventory.InventorySessionBean.queryInventory(InventorySess
    ionBean.java:1343)
    at
    com.metasolv.oss.inventory.InventorySessionBean_xf0gis_EOImpl.queryInventory
    (InventorySessionBean_xf0gis_EOImpl.java:3998)
    at
    com.metasolv.oss.inventory.InventorySessionBean_xf0gis_EOImpl_WLSkel.invoke(
    Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:362)
    at
    weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java
    :114)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:313)
    at
    weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
    r.java:821)
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:308)
    >
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:3
    0)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189)
    NestedThrowablesStackTrace:
    java.sql.SQLException: Syntax error or access violation, message from
    server: "You have an error in your SQL syntax. Check the manual that
    corresponds to your MySQL server version for the right syntax to use near
    'WHERE NOT (t0.PK = t1.channel AND t0.supporting = '101/DS3/LOC0"
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1651)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:889)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:956)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:1874)
    at
    com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1538)
    at
    com.solarmetric.datasource.PreparedStatementWrapper.executeQuery(PreparedSta
    tementWrapper.java:93)
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedQueryI
    nternal(SQLExecutionManagerImpl.java:707)
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeQueryInternal(
    SQLExecutionManagerImpl.java:600)
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeQuery(SQLExecu
    tionManagerImpl.java:355)
    at
    com.solarmetric.kodo.impl.jdbc.ormapping.ClassMapping.selectPrimaryMappings(
    ClassMapping.java:1743)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.executeQuery(JDBCSto
    reManager.java:1136)
    at
    com.solarmetric.kodo.impl.jdbc.query.JDBCQuery.executeQuery(JDBCQuery.java:1
    26)
    at
    com.solarmetric.kodo.query.QueryImpl$DatastoreQueryExecutor.executeQuery(Que
    ryImpl.java:1565)
    at
    com.solarmetric.kodo.query.QueryImpl$AggregateQueryExecutor.executeQuery(Que
    ryImpl.java:1401)
    at
    com.solarmetric.kodo.query.QueryImpl.executeQueryWithMap(QueryImpl.java:685)
    >
    atcom.solarmetric.kodo.query.QueryImpl.executeWithMap(QueryImpl.java:545)
    >
    at
    com.solarmetric.kodo.query.QueryImpl.executeWithArray(QueryImpl.java:531)
    at com.solarmetric.kodo.query.QueryImpl.execute(QueryImpl.java:513)
    at
    com.metasolv.resources.queries.ChannelAvailabilityQueryBean.execute(ChannelA
    vailabilityQueryBean.java:55)
    at
    com.metasolv.oss.inventory.InventorySessionBean.queryInventory(InventorySess
    ionBean.java:1343)
    at
    com.metasolv.oss.inventory.InventorySessionBean_xf0gis_EOImpl.queryInventory
    (InventorySessionBean_xf0gis_EOImpl.java:3998)
    at
    com.metasolv.oss.inventory.InventorySessionBean_xf0gis_EOImpl_WLSkel.invoke(
    Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:362)
    at
    weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java
    :114)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:313)
    at
    weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
    r.java:821)
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:308)
    >
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:3
    0)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189)
    INFO ExecuteThread: '10' for queue: 'default' com.metasolv.oss.inventory -
    ignoring exception
    javax.oss.IllegalArgumentException:
    com.solarmetric.kodo.runtime.DataStoreException:
    com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper:
    [SQL=SELECT DISTINCT t0.PK, t0.JDOCLASSX, t0.JDOLOCKX, t0.AEndPoint,
    t0.AEndPointType, t0.DS0, t0.DS1, t0.DS2, t0.DS3, t0.DS4, t0.ZEndPoint,
    t0.ZEndPointType, t0.adminState, t0.creationDate, t0.SPECKEY, t0.SPECTYPE,
    t0.description, t0.lastModifiedDate, t0.lastModifiedUserId, t0.LASTUPDATE,
    t0.name, t0.note, t0.previousVersion, t0.resourceBusinessName,
    t0.signalType, t0.supporting, t0.direction, t0.validForEnd,
    t0.validForStart> FROM DSChannel t0 LEFT OUTER JOIN ChannelSegment t1 WHERE NOT (t0.PK => t1.channel AND t0.supporting = '101/DS3/LOC01/LOC02' AND (t1.validForEnd >> {ts '2001-07-24 20:59:49.0' OR t1.validForStart < {ts '2038-01-18
    22:14:07.0'}))]
    [PRE=SELECT DISTINCT t0.PK, t0.JDOCLASSX, t0.JDOLOCKX, t0.AEndPoint,
    t0.AEndPointType, t0.DS0, t0.DS1, t0.DS2, t0.DS3, t0.DS4, t0.ZEndPoint,
    t0.ZEndPointType, t0.adminState, t0.creationDate, t0.SPECKEY, t0.SPECTYPE,
    t0.description, t0.lastModifiedDate, t0.lastModifiedUserId, t0.LASTUPDATE,
    t0.name, t0.note, t0.previousVersion, t0.resourceBusinessName,
    t0.signalType, t0.supporting, t0.direction, t0.validForEnd,
    t0.validForStart> FROM DSChannel t0 LEFT OUTER JOIN ChannelSegment t1 WHERE NOT (t0.PK => t1.channel AND t0.supporting = ? AND (t1.validForEnd > ? ORt1.validForStart> < ?))
    Syntax error or access violation, message from server: "You have an error
    in your SQL syntax. Check the manual that corresponds to your MySQLserver
    version for the right syntax to use near 'WHERE NOT (t0.PK = t1.channelAND
    t0.supporting = '101/DS3/LOC0" [code=1064;state=42000]
    NestedThrowables:
    com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper:
    [SQL=SELECT DISTINCT t0.PK, t0.JDOCLASSX, t0.JDOLOCKX, t0.AEndPoint,
    t0.AEndPointType, t0.DS0, t0.DS1, t0.DS2, t0.DS3, t0.DS4, t0.ZEndPoint,
    t0.ZEndPointType, t0.adminState, t0.creationDate, t0.SPECKEY, t0.SPECTYPE,
    t0.description, t0.lastModifiedDate, t0.lastModifiedUserId, t0.LASTUPDATE,
    t0.name, t0.note, t0.previousVersion, t0.resourceBusinessName,
    t0.signalType, t0.supporting, t0.direction, t0.validForEnd,
    t0.validForStart> FROM DSChannel t0 LEFT OUTER JOIN ChannelSegment t1 WHERE NOT (t0.PK => t1.channel AND t0.supporting = '101/DS3/LOC01/LOC02' AND (t1.validForEnd >> {ts '2001-07-24 20:59:49.0' OR t1.validForStart < {ts '2038-01-18
    22:14:07.0'}))]
    [PRE=SELECT DISTINCT t0.PK, t0.JDOCLASSX, t0.JDOLOCKX, t0.AEndPoint,
    t0.AEndPointType, t0.DS0, t0.DS1, t0.DS2, t0.DS3, t0.DS4, t0.ZEndPoint,
    t0.ZEndPointType, t0.adminState, t0.creationDate, t0.SPECKEY, t0.SPECTYPE,
    t0.description, t0.lastModifiedDate, t0.lastModifiedUserId, t0.LASTUPDATE,
    t0.name, t0.note, t0.previousVersion, t0.resourceBusinessName,
    t0.signalType, t0.supporting, t0.direction, t0.validForEnd,
    t0.validForStart> FROM DSChannel t0 LEFT OUTER JOIN ChannelSegment t1 WHERE NOT (t0.PK => t1.channel AND t0.supporting = ? AND (t1.validForEnd > ? ORt1.validForStart> < ?))
    Syntax error or access violation, message from server: "You have an error
    in your SQL syntax. Check the manual that corresponds to your MySQLserver
    version for the right syntax to use near 'WHERE NOT (t0.PK = t1.channelAND
    t0.supporting = '101/DS3/LOC0"
    at
    com.metasolv.resources.queries.ChannelAvailabilityQueryBean.execute(ChannelA
    vailabilityQueryBean.java:61)
    at
    com.metasolv.oss.inventory.InventorySessionBean.queryInventory(InventorySess
    ionBean.java:1343)
    at
    com.metasolv.oss.inventory.InventorySessionBean_xf0gis_EOImpl.queryInventory
    (InventorySessionBean_xf0gis_EOImpl.java:3998)
    at
    com.metasolv.oss.inventory.InventorySessionBean_xf0gis_EOImpl_WLSkel.invoke(
    Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:362)
    at
    weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java
    :114)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:313)
    at
    weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
    r.java:821)
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:308)
    >
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:3
    0)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189)
    Ben

    Ben-
    Is the SQL statement that is being executed returning incorrect results,
    or is it causing an exception with the MySQL server?
    If the former, can you describe the results you are seeing? If the
    latter, can you post the stack trace?
    In article <[email protected]>, Ben Eng wrote:
    This is still not producing the correct result set in Kodo JDO 3.0.0RC4. I
    see the following SQL statement in the log.
    DEBUG ExecuteThread: '10' for queue: 'default' kodo.jdbc.SQL - <t 7720801,
    conn 5232795> [10 ms] executing prepstmnt 1654874 SELECT DISTINCT t0.pk,
    t0.JDOCLASS, t0.JDOVERSION, t0.AEndPoint, t0.AEndPointType, t0.DS0, t0.DS1,
    t0.DS2, t0.DS3, t0.DS4, t0.ZEndPoint, t0.ZEndPointType, t0.adminState,
    t0.creationDate, t0.speckey, t0.spectype, t0.description,
    t0.lastModifiedDate, t0.lastModifiedUserId, t0.lastupdate, t0.name, t0.note,
    t0.previousVersion, t0.resourceBusinessName, t0.signalType, t0.supporting,
    t0.direction, t0.validForEnd, t0.validForStart FROM dschannel t0 CROSS JOIN
    channelsegment t1 WHERE (NOT (t0.pk = t1.channel AND t0.supporting = ? AND
    (t1.validForEnd > ? OR t1.validForStart < ?))) [params=(String)
    101/DS3/LOC01/LOC02, (Timestamp) 2001-07-24 20:29:14.0, (Timestamp)
    2038-01-18 22:14:07.0]
    INFO ExecuteThread: '10' for queue: 'default' com.metasolv.oss.inventory -
    resultSet size=0
    It looks to me like the CROSS JOIN is not the right join to be using. ---
    unless I am doing something altogether incorrect in the JDO Query itself,
    which is highly likely.
    Ben
    "Ben Eng" <[email protected]> wrote in message news:...
    Using Kodo JDO 2.5.3, I am attempting to do queries of the following form:
    select * from dschannel as c
    where not exists (select pk from channelsegment as s
    where c.pk = s.channel and
    c.supporting = ? and
    (s.validForEnd > ? or
    s.validForStart < ?));
    select * from dschannel as c
    left join channelsegment as s
    on c.pk = s.channel and
    c.supporting = ? and
    (s.validForEnd > ? or
    s.validForStart < ?)
    where s.channel is null;
    The code looks like this:
    extent = pm.getExtent( ChannelValue.class, true );
    query = pm.newQuery( this.extent );
    query.declareImports( "import
    com.metasolv.resources.entity.connection.ChannelSegmentValueImpl; import
    java.util.Date;" );
    query.declareParameters( "String pConn, Date pStart, Date pEnd" );
    query.declareVariables( "ChannelSegmentValueImpl assign" );
    String filter = "! (key == assign.channel && supportingConnection == pConn
    && (assign.validForEnd > pStart || assign.validForStart < pEnd))";
    query.setFilter( filter );
    resultSet = (java.util.Collection) query.execute( connection,
    interval.getStartDateTime(), interval.getEndDateTime() );
    I am seeing the following Exception with mysql 4.0.15 and mysql connector
    JDBC driver 3.0.8:
    com.solarmetric.kodo.runtime.DataStoreException:
    com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper:
    [SQL=SELECT DISTINCT t0.PK, t0.JDOCLASSX, t0.JDOLOCKX, t0.AEndPoint,
    t0.AEndPointType, t0.DS0, t0.DS1, t0.DS2, t0.DS3, t0.DS4, t0.ZEndPoint,
    t0.ZEndPointType, t0.adminState, t0.creationDate, t0.SPECKEY, t0.SPECTYPE,
    t0.description, t0.lastModifiedDate, t0.lastModifiedUserId, t0.LASTUPDATE,
    t0.name, t0.note, t0.previousVersion, t0.resourceBusinessName,
    t0.signalType, t0.supporting, t0.direction, t0.validForEnd,
    t0.validForStart>> FROM DSChannel t0 LEFT OUTER JOIN ChannelSegment t1 WHERE NOT (t0.PK =>> t1.channel AND t0.supporting = '101/DS3/LOC01/LOC02' AND (t1.validForEnd >>> {ts '2001-07-24 20:59:49.0' OR t1.validForStart < {ts '2038-01-18
    22:14:07.0'}))]
    [PRE=SELECT DISTINCT t0.PK, t0.JDOCLASSX, t0.JDOLOCKX, t0.AEndPoint,
    t0.AEndPointType, t0.DS0, t0.DS1, t0.DS2, t0.DS3, t0.DS4, t0.ZEndPoint,
    t0.ZEndPointType, t0.adminState, t0.creationDate, t0.SPECKEY, t0.SPECTYPE,
    t0.description, t0.lastModifiedDate, t0.lastModifiedUserId, t0.LASTUPDATE,
    t0.name, t0.note, t0.previousVersion, t0.resourceBusinessName,
    t0.signalType, t0.supporting, t0.direction, t0.validForEnd,
    t0.validForStart>> FROM DSChannel t0 LEFT OUTER JOIN ChannelSegment t1 WHERE NOT (t0.PK =>> t1.channel AND t0.supporting = ? AND (t1.validForEnd > ? OR> t1.validForStart>> < ?))
    Syntax error or access violation, message from server: "You have an error
    in your SQL syntax. Check the manual that corresponds to your MySQLserver
    version for the right syntax to use near 'WHERE NOT (t0.PK = t1.channelAND
    t0.supporting = '101/DS3/LOC0" [code=1064;state=42000]
    NestedThrowables:
    com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper:
    [SQL=SELECT DISTINCT t0.PK, t0.JDOCLASSX, t0.JDOLOCKX, t0.AEndPoint,
    t0.AEndPointType, t0.DS0, t0.DS1, t0.DS2, t0.DS3, t0.DS4, t0.ZEndPoint,
    t0.ZEndPointType, t0.adminState, t0.creationDate, t0.SPECKEY, t0.SPECTYPE,
    t0.description, t0.lastModifiedDate, t0.lastModifiedUserId, t0.LASTUPDATE,
    t0.name, t0.note, t0.previousVersion, t0.resourceBusinessName,
    t0.signalType, t0.supporting, t0.direction, t0.validForEnd,
    t0.validForStart>> FROM DSChannel t0 LEFT OUTER JOIN ChannelSegment t1 WHERE NOT (t0.PK =>> t1.channel AND t0.supporting = '101/DS3/LOC01/LOC02' AND (t1.validForEnd >>> {ts '2001-07-24 20:59:49.0' OR t1.validForStart < {ts '2038-01-18
    22:14:07.0'}))]
    [PRE=SELECT DISTINCT t0.PK, t0.JDOCLASSX, t0.JDOLOCKX, t0.AEndPoint,
    t0.AEndPointType, t0.DS0, t0.DS1, t0.DS2, t0.DS3, t0.DS4, t0.ZEndPoint,
    t0.ZEndPointType, t0.adminState, t0.creationDate, t0.SPECKEY, t0.SPECTYPE,
    t0.description, t0.lastModifiedDate, t0.lastModifiedUserId, t0.LASTUPDATE,
    t>> 0.name, t0.note, t0.previousVersion, t0.resourceBusinessName,> t0.signalType,>> t0.supporting, t0.direction, t0.validForEnd, t0.validForStart FROM> DSChannel>> t0 LEFT OUTER JOIN ChannelSegment t1 WHERE NOT (t0.PK = t1.channel AND>> t0.supporting = ? AND (t1.validForEnd > ? OR t1.validForStart < ?))
    Syntax error or access violation, message from server: "You have an error
    in your SQL syntax. Check the manual that corresponds to your MySQLserver
    version for the right syntax to use near 'WHERE NOT (t0.PK = t1.channelAND
    t0.supporting = '101/DS3/LOC0"
    at
    com.solarmetric.kodo.impl.jdbc.runtime.SQLExceptions.throwDataStore(SQLExcep
    tions.java:64)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.executeQuery(JDBCSto
    reManager.java:1167)
    at
    com.solarmetric.kodo.impl.jdbc.query.JDBCQuery.executeQuery(JDBCQuery.java:1
    26)
    at
    com.solarmetric.kodo.query.QueryImpl$DatastoreQueryExecutor.executeQuery(Que
    ryImpl.java:1565)
    at
    com.solarmetric.kodo.query.QueryImpl$AggregateQueryExecutor.executeQuery(Que
    ryImpl.java:1401)
    at
    com.solarmetric.kodo.query.QueryImpl.executeQueryWithMap(QueryImpl.java:685)
    atcom.solarmetric.kodo.query.QueryImpl.executeWithMap(QueryImpl.java:545)
    at
    com.solarmetric.kodo.query.QueryImpl.executeWithArray(QueryImpl.java:531)
    at com.solarmetric.kodo.query.QueryImpl.execute(QueryImpl.java:513)
    at
    com.metasolv.resources.queries.ChannelAvailabilityQueryBean.execute(ChannelA
    vailabilityQueryBean.java:55)
    at
    com.metasolv.oss.inventory.InventorySessionBean.queryInventory(InventorySess
    ionBean.java:1343)
    at
    com.metasolv.oss.inventory.InventorySessionBean_xf0gis_EOImpl.queryInventory
    (InventorySessionBean_xf0gis_EOImpl.java:3998)
    at
    com.metasolv.oss.inventory.InventorySessionBean_xf0gis_EOImpl_WLSkel.invoke(
    Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:362)
    at
    weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java
    :114)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:313)
    at
    weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
    r.java:821)
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:308)
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:3
    0)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189)
    NestedThrowablesStackTrace:
    java.sql.SQLException: Syntax error or access violation, message from
    server: "You have an error in your SQL syntax. Check the manual that
    corresponds to your MySQL server version for the right syntax to use near
    'WHERE NOT (t0.PK = t1.channel AND t0.supporting = '101/DS3/LOC0"
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1651)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:889)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:956)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:1874)
    at
    com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1538)
    at
    com.solarmetric.datasource.PreparedStatementWrapper.executeQuery(PreparedSta
    tementWrapper.java:93)
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedQueryI
    nternal(SQLExecutionManagerImpl.java:707)
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeQueryInternal(
    SQLExecutionManagerImpl.java:600)
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeQuery(SQLExecu
    tionManagerImpl.java:355)
    at
    com.solarmetric.kodo.impl.jdbc.ormapping.ClassMapping.selectPrimaryMappings(
    ClassMapping.java:1743)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.executeQuery(JDBCSto
    reManager.java:1136)
    at
    com.solarmetric.kodo.impl.jdbc.query.JDBCQuery.executeQuery(JDBCQuery.java:1
    26)
    at
    com.solarmetric.kodo.query.QueryImpl$DatastoreQueryExecutor.executeQuery(Que
    ryImpl.java:1565)
    at
    com.solarmetric.kodo.query.QueryImpl$AggregateQueryExecutor.executeQuery(Que
    ryImpl.java:1401)
    at
    com.solarmetric.kodo.query.QueryImpl.executeQueryWithMap(QueryImpl.java:685)
    atcom.solarmetric.kodo.query.QueryImpl.executeWithMap(QueryImpl.java:545)
    at
    com.solarmetric.kodo.query.QueryImpl.executeWithArray(QueryImpl.java:531)
    at com.solarmetric.kodo.query.QueryImpl.execute(QueryImpl.java:513)
    at
    com.metasolv.resources.queries.ChannelAvailabilityQueryBean.execute(ChannelA
    vailabilityQueryBean.java:55)
    at
    com.metasolv.oss.inventory.InventorySessionBean.queryInventory(InventorySess
    ionBean.java:1343)
    at
    com.metasolv.oss.inventory.InventorySessionBean_xf0gis_EOImpl.queryInventory
    (InventorySessionBean_xf0gis_EOImpl.java:3998)
    at
    com.metasolv.oss.inventory.InventorySessionBean_xf0gis_EOImpl_WLSkel.invoke(
    Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:362)
    at
    weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java
    :114)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:313)
    at
    weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
    r.java:821)
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:308)
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:3
    0)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189)
    INFO ExecuteThread: '10' for queue: 'default' com.metasolv.oss.inventory -
    ignoring exception
    javax.oss.IllegalArgumentException:
    com.solarmetric.kodo.runtime.DataStoreException:
    com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper:
    [SQL=SELECT DISTINCT t0.PK, t0.JDOCLASSX, t0.JDOLOCKX, t0.AEndPoint,
    t0.AEndPointType, t0.DS0, t0.DS1, t0.DS2, t0.DS3, t0.DS4, t0.ZEndPoint,
    t0.ZEndPointType, t0.adminState, t0.creationDate, t0.SPECKEY, t0.SPECTYPE,
    t0.description, t0.lastModifiedDate, t0.lastModifiedUserId, t0.LASTUPDATE,
    t0.name, t0.note, t0.previousVersion, t0.resourceBusinessName,
    t0.signalType, t0.supporting, t0.direction, t0.validForEnd,
    t0.validForStart>> FROM DSChannel t0 LEFT OUTER JOIN ChannelSegment t1 WHERE NOT (t0.PK =>> t1.channel AND t0.supporting = '101/DS3/LOC01/LOC02' AND (t1.validForEnd >>> {ts '2001-07-24 20:59:49.0' OR t1.validForStart < {ts '2038-01-18
    22:14:07.0'}))]
    [PRE=SELECT DISTINCT t0.PK, t0.JDOCLASSX, t0.JDOLOCKX, t0.AEndPoint,
    t0.AEndPointType, t0.DS0, t0.DS1, t0.DS2, t0.DS3, t0.DS4, t0.ZEndPoint,
    t0.ZEndPointType, t0.adminState, t0.creationDate, t0.SPECKEY, t0.SPECTYPE,
    t0.description, t0.lastModifiedDate, t0.lastModifiedUserId, t0.LASTUPDATE,
    t0.name, t0.note, t0.previousVersion, t0.resourceBusinessName,
    t0.signalType, t0.supporting, t0.direction, t0.validForEnd,
    t0.validForStart>> FROM DSChannel t0 LEFT OUTER JOIN ChannelSegment t1 WHERE NOT (t0.PK =>> t1.channel AND t0.supporting = ? AND (t1.validForEnd > ? OR> t1.validForStart>> < ?))
    Syntax error or access violation, message from server: "You have an error
    in your SQL syntax. Check the manual that corresponds to your MySQLserver
    version for the right syntax to use near 'WHERE NOT (t0.PK = t1.channelAND
    t0.supporting = '101/DS3/LOC0" [code=1064;state=42000]
    NestedThrowables:
    com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper:
    [SQL=SELECT DISTINCT t0.PK, t0.JDOCLASSX, t0.JDOLOCKX, t0.AEndPoint,
    t0.AEndPointType, t0.DS0, t0.DS1, t0.DS2, t0.DS3, t0.DS4, t0.ZEndPoint,
    t0.ZEndPointType, t0.adminState, t0.creationDate, t0.SPECKEY, t0.SPECTYPE,
    t0.description, t0.lastModifiedDate, t0.lastModifiedUserId, t0.LASTUPDATE,
    t0.name, t0.note, t0.previousVersion, t0.resourceBusinessName,
    t0.signalType, t0.supporting, t0.direction, t0.validForEnd,
    t0.validForStart>> FROM DSChannel t0 LEFT OUTER JOIN ChannelSegment t1 WHERE NOT (t0.PK =>> t1.channel AND t0.supporting = '101/DS3/LOC01/LOC02' AND (t1.validForEnd >>> {ts '2001-07-24 20:59:49.0' OR t1.validForStart < {ts '2038-01-18
    22:14:07.0'}))]
    [PRE=SELECT DISTINCT t0.PK, t0.JDOCLASSX, t0.JDOLOCKX, t0.AEndPoint,
    t0.AEndPointType, t0.DS0, t0.DS1, t0.DS2, t0.DS3, t0.DS4, t0.ZEndPoint,
    t0.ZEndPointType, t0.adminState, t0.creationDate, t0.SPECKEY, t0.SPECTYPE,
    t0.description, t0.lastModifiedDate, t0.lastModifiedUserId, t0.LASTUPDATE,
    t0.name, t0.note, t0.previousVersion, t0.resourceBusinessName,
    t0.signalType, t0.supporting, t0.direction, t0.validForEnd,
    t0.validForStart>> FROM DSChannel t0 LEFT OUTER JOIN ChannelSegment t1 WHERE NOT (t0.PK =>> t1.channel AND t0.supporting = ? AND (t1.validForEnd > ? OR> t1.validForStart>> < ?))
    Syntax error or access violation, message from server: "You have an error
    in your SQL syntax. Check the manual that corresponds to your MySQLserver
    version for the right syntax to use near 'WHERE NOT (t0.PK = t1.channelAND
    t0.supporting = '101/DS3/LOC0"
    at
    com.metasolv.resources.queries.ChannelAvailabilityQueryBean.execute(ChannelA
    vailabilityQueryBean.java:61)
    at
    com.metasolv.oss.inventory.InventorySessionBean.queryInventory(InventorySess
    ionBean.java:1343)
    at
    com.metasolv.oss.inventory.InventorySessionBean_xf0gis_EOImpl.queryInventory
    (InventorySessionBean_xf0gis_EOImpl.java:3998)
    at
    com.metasolv.oss.inventory.InventorySessionBean_xf0gis_EOImpl_WLSkel.invoke(
    Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:362)
    at
    weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java
    :114)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:313)
    at
    weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
    r.java:821)
    at
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:308)
    at
    weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:3
    0)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:213)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:189)
    Ben
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • I need a script that will find the computer a user last logged into.

    I am still learning scripting, I need a script that will allow me to pull in usernames from a csv file. Find what computer they last logged into and output that to an csv file.
    I have looked all over and can't find exactly what I need.
     I found the following script but I need  to add the resuitsize unlimited but can not figure out where to put it we have a large environment. Also I need to be able to grab username from a csv file. Any assistance you can provide is appreciated.
    ##  Find out what computers a user is logged into on your domain by running the script
    ##  and entering in the requested logon id for the user.
    ##  This script requires the free Quest ActiveRoles Management Shell for Active Directory
    ##  snapin  http://www.quest.com/powershell/activeroles-server.aspx
    Add-PSSnapin Quest.ActiveRoles.ADManagement -ErrorAction SilentlyContinue
    $ErrorActionPreference = "SilentlyContinue"
    # Retrieve Username to search for, error checks to make sure the username
    # is not blank and that it exists in Active Directory
    Function Get-Username {
    $Global:Username = Read-Host "Enter username you want to search for"
    if ($Username -eq $null){
    Write-Host "Username cannot be blank, please re-enter username!!!!!"
    Get-Username}
    $UserCheck = Get-QADUser -SamAccountName $Username
    if ($UserCheck -eq $null){
    Write-Host "Invalid username, please verify this is the logon id for the account"
    Get-Username}
    get-username resultsize unlimited
    $computers = Get-QADComputer | where {$_.accountisdisabled -eq $false}
    foreach ($comp in $computers)
    $Computer = $comp.Name
    $ping = new-object System.Net.NetworkInformation.Ping
      $Reply = $null
      $Reply = $ping.send($Computer)
      if($Reply.status -like 'Success'){
    #Get explorer.exe processes
    $proc = gwmi win32_process -computer $Computer -Filter "Name = 'explorer.exe'"
    #Search collection of processes for username
    ForEach ($p in $proc) {
    $temp = ($p.GetOwner()).User
    if ($temp -eq $Username){
    write-host "$Username is logged on $Computer"

    If you are querying by user "resultset size" will be of no use.
    You also have functions that are never used and the body code doe snot look for users.
    Here is what you scrip looks like if printed well.  It is just a jumble of pasted together and unrelated items.
    ## Find out what computers a user is logged into on your domain by running the script
    ## and entering in the requested logon id for the user.
    ## This script requires the free Quest ActiveRoles Management Shell for Active Directory
    ## snapin http://www.quest.com/powershell/activeroles-server.aspx
    Add-PSSnapin Quest.ActiveRoles.ADManagement -ErrorAction SilentlyContinue
    $ErrorActionPreference = "SilentlyContinue"
    # Retrieve Username to search for, error checks to make sure the username
    # is not blank and that it exists in Active Directory
    Function Get-Username {
    $Global:Username = Read-Host "Enter username you want to search for"
    if ($Username -eq $null) {
    Write-Host "Username cannot be blank, please re-enter username!!!!!"
    Get-Username
    $UserCheck = Get-QADUser -SamAccountName $Username
    if ($UserCheck -eq $null) {
    Write-Host "Invalid username, please verify this is the logon id for the account"
    Get-Username
    get-username resultsize unlimited
    $computers = Get-QADComputer | where { $_.accountisdisabled -eq $false }
    foreach ($comp in $computers) {
    $Computer = $comp.Name
    $ping = new-object System.Net.NetworkInformation.Ping
    $Reply = $null
    $Reply = $ping.send($Computer)
    if ($Reply.status -like 'Success') {
    #Get explorer.exe processes
    $proc = gwmi win32_process -computer $Computer -Filter "Name = 'explorer.exe'"
    #Search collection of processes for username
    ForEach ($p in $proc) {
    $temp = ($p.GetOwner()).User
    if ($temp -eq $Username) {
    write-host "$Username is logged on $Computer"
    I suggest finding the original code then use the learning link at the top of this page to help you understand how it works in Powershell.
    ¯\_(ツ)_/¯

  • Bulk Metadata Update using RIDC API!!

    Hi,
    In my program I have to update bulk content's metadata value. For example I would like to update 'xComments' filed through my RIDC api call in java for 40K contents. In the last run the program was taking huge amount of time(in hours) to update the contents.
    Could you please advise me any performence fine tuning or alternate operation to reduce the metadata update time. The java program runs in a single thread. Find the RIDC doc_update code below.
    Code:
    import oracle.stellent.ridc.*;
    import oracle.stellent.ridc.model.*;
    import oracle.stellent.ridc.protocol.*;
    public class UpdateMetadata {
         private static IdcContext userContext = null;
         static public void main(String args[]) throws Exception {
              System.out.println("RIDC - tests");
              IdcClient idcClient = null;
              try {
                   // Create the Manager
              IdcClientManager manager = new IdcClientManager();
                   idcClient = manager.createClient("idc://<IPADDRESS>:4444");
                   IdcContext userContext = new IdcContext("sysadmin");
                   DataBinder binder = idcClient.createBinder();
                   binder.putLocal("IdcService", "UPDATE_DOCINFO");
              for(int i=0;i<Resultset.size();i++)
                   binder.putLocal("dID", resultset.did);
                   binder.putLocal("dDocName", resultset.ContentID[i]);
                   binder.putLocal("xComments","****True****");
                   ServiceResponse response = idcClient.sendRequest(userContext,binder);
                   System.out.println("Processed");
                   DataResultSet resultSet = binders.getResultSet ("SearchResults");
                   // loop over the results
                   for (DataObject dataObject : resultSet.getRows ()) {
                        System.out.println ("Title is: " + dataObject.get ("dDocTitle"));
                        System.out.println ("Author is: " + dataObject.get ("dDocAuthor"));
              } catch (IdcClientException ie) {
                   System.out.println("Exception while creating the client" + ie);

    The code seems to be incomplete:
    - there are some variables like Resultset, resultset that are not initialized in the code (but probably are somewhere else)
    - there is a line }*/, but no starting /* (could be corrupted by the editor)
    Anyway, if you write that
    In the last run the program was taking huge amount of time(in hours) to update the contents. I'd focus first for a question: what has changed? Btw. what is the expected (experienced?) result?
    As for the code, it looks OK to me. You could probably throw away everything behind ServiceResponse response = idcClient.sendRequest(userContext,binder); but it seems the second loop is commented out anyway.
    To reach better performance, you can certainly try to run the program in several threads - it will require some fine tuning to find out how many threads are optimal. For CHECKIN_NEW, we had the best performance with 3 threads in parallel, but it operated with 100-500kB files, so I'm not sure if these results are relevant also for UPDATE_INFO. I doubt, however, that improvements achieved with parallelism can be higher than let's say 2-3x faster.

  • JTable question regarding Index/ID's from a VB guy

    Greets!
    So i am coming from VB6 where i use an ActiveX object table to display data from a SQL database table. When populating the table i include the 'ID' field from the database table as a hidden column. So when a user selects a row, i pull the hidden column's ID# and use that to do whatever (bring up another edit form, etc)
    So here i am in Java now, i've been playing with jTable for a while now and seem to be getting the hang of the basics, but when i replicated the above scenario, hiding the ID column had weird results (cursor would dissappear when i scroll over with the arrow keys). I also saw another post where another person said that along with populating the jTable i should also have an array that stores the ID that matches the RowIndex from the jTable itself.
    This is the table model that i am using:
    public class jTableModel extends AbstractTableModel {
        private double xTotal;
        private int colnum;
        private int rownum;
        private String[] colNames;
        private  ArrayList<Object[]> ResultSets;
        private Icon zIcon;
        /** Creates a new instance of FoodTableModel */
        public jTableModel(ResultSet rs,frmMain frm) {
          ResultSets=new ArrayList<Object[]>(); 
          Icon icon1 = new ImageIcon(getClass().getResource("/main/images/bullet_ball_glass_blue.png"));
          Icon icon2 = new ImageIcon(getClass().getResource("/main/images/bullet_ball_glass_red.png"));
          Icon icon3 = new ImageIcon(getClass().getResource("/main/images/bullet_ball_glass_green.png"));
          try{
            while(rs.next()){
                switch (rs.getInt("Type")) {
                    case 1: zIcon = icon1; break;
                    case 2: zIcon = icon2; break;
                    case 3: zIcon = icon3; break;
                Object[] row={zIcon,rs.getString("Name"),rs.getString("Description"),rs.getString("ID")};
                ResultSets.add(row);
            String[] zNames={
                "","Name","Description","ID"
            colNames = zNames;
            colnum=4;
          catch(Exception e){
              System.out.println("(jTableModel: There was an error: " + e);
        public Object getValueAt(int rowindex, int columnindex) {
           Object[] row=ResultSets.get(rowindex);
           return row[columnindex];
        public int getRowCount() {
            return ResultSets.size();
        public int getColumnCount() {
            return colnum;
        @Override
        public String getColumnName(int param) {
           return colNames[param];
        public double getTotal() {
            return xTotal;
        @Override
        public Class getColumnClass(int column) {
         return getValueAt(0, column).getClass();
        }Can anyone give me any tips in this area or point me in the right direction?
    Any help would be appreciated.

    Dear Poster,
    As no response has been provided to the thread in some time I must assume the issue is resolved, if the question is still valid please create a new thread rephrasing the query and providing as much data as possible to promote response from the community.
    Best Regards,
    SDN SRM Moderation Team

  • Defaulttablemodel problem please help me

    i created a class defaulttablemodel and a main class with jtable and compiled without error but when i run it nothing happens my frame is not showing in my desktop
    here is my class default table model:
    import java.util.ArrayList;
    import java.sql.*;
    import javax.swing.JOptionPane;
    import javax.swing.table.DefaultTableModel;
    * @author jay
    public class cartablemodel extends DefaultTableModel
        private int colnum=5;
        private int rownum;
        private String[] colnames={"ID", "Name","Last Name", "Age", "Contact Number",};
        private ArrayList<String[]> ResultSets;
        public cartablemodel(ResultSet rs)
            ResultSets = new ArrayList<String[]>();
            try
                while(rs.next())
                    String[] row={rs.getString("id"), rs.getString("name"),
                    rs.getString("lastname"), rs.getString("age"), rs.getString("contactno")
                    ResultSets.add(row);
            catch(Exception e)
                JOptionPane.showMessageDialog(null, e.getMessage());
        public Object getValueAt(int rowindex, int columnindex)
            String[] row = ResultSets.get(rowindex);
            return row[columnindex];
        public int getRowCount()
            return ResultSets.size();
        public int getColumnCount()
            return colnum;
        public String getColumnName(int param)
            return colnames[param];
    }

    sorry for the long code im using netbeans for gui this is the main class
    import java.sql.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class inserttable extends javax.swing.JFrame {
        /** Creates new form inserttable */
        public inserttable() throws Exception
           mydb  = new dbconnection();
           mydb.init();
           Connection con = mydb.getmyconnection();
           st = con.createStatement();
            initComponents();
        public ResultSet getresultfromregister()
            ResultSet rs=null;
            try
                rs=st.executeQuery("select * from register");
            }//end try
            catch(SQLException sqlexception)
                JOptionPane.showMessageDialog(null, sqlexception.getMessage(),
                        "Error displaying database", JOptionPane.ERROR_MESSAGE);
            }//end catch
            return rs;
        }//end method getresultfromregister
    private void initComponents() {
            jScrollPane1 = new javax.swing.JScrollPane();
            cartable = new javax.swing.JTable();
            cmdadd = new javax.swing.JButton();
            cmddelete = new javax.swing.JButton();
            cmdlogout = new javax.swing.JButton();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            addWindowListener(new java.awt.event.WindowAdapter() {
                public void windowActivated(java.awt.event.WindowEvent evt) {
                    formWindowActivated(evt);
                public void windowClosing(java.awt.event.WindowEvent evt) {
                    formWindowClosing(evt);
            ResultSet rs = getresultfromregister();
            cartable.setAutoCreateRowSorter(true);
            cartable.setModel(new cartablemodel(rs)
            cartable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_ALL_COLUMNS);
            mydb.close(rs);
            jScrollPane1.setViewportView(cartable);
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(21, 21, 21)
                    .addComponent(cmdadd, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(cmddelete, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(cmdlogout, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap())
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 792, Short.MAX_VALUE)
            layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {cmdadd, cmddelete, cmdlogout});
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 472, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(39, 39, 39)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(cmddelete, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(cmdadd, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGap(44, 44, 44))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                            .addComponent(cmdlogout, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(44, 44, 44))))
            layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {cmdadd, cmddelete, cmdlogout});
            java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
            setBounds((screenSize.width-800)/2, (screenSize.height-600)/2, 800, 600);
        }// </editor-fold>
    public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    try {
                        new inserttable().setVisible(true);
                    } catch (Exception ex) {
        private dbconnection mydb;
        private java.sql.Statement st;
        // Variables declaration - do not modify                    
        public javax.swing.JTable cartable;
        private javax.swing.JButton cmdadd;
        private javax.swing.JButton cmddelete;
        private javax.swing.JButton cmdlogout;
        private javax.swing.JScrollPane jScrollPane1;
        // End of variables declarationEdited by: Jaywhy on Apr 21, 2009 7:11 PM
    Edited by: Jaywhy on Apr 21, 2009 7:12 PM

  • Elements of Vector

    Hi,
    I have got an vector called resultSet which contains String objects as elements.
    eg.
    NAME_FORMAT_TYPE
    BON_PERF_REL
    CER_FIGURE
    CER_PERF
    CER_QUOTE
    CUR_PERF
    CUR_QUOTE
    VALUE_FORMAT_TYPE
    +T2PC
    T2
    +T2C
    T2
    +T4C
    T4
    T2P
    T2P
    DESCRIPTION_FORMAT_TYPE
    Format: �#.##0,00% Colored
    Format: -#.##0,00
    Format: �#.##0,00 Colored
    Format: -#.##0,00
    Format: �#.##0,0000 Colored
    Format: -#.##0,0000
    Format: -#.##0,00%
    Now I want to put all the elements after NAME_FORMAT_TYPE to be put in a Vector called name and like wise all the elements after VALUE_FORMAT_TYPE
    to be put in a vector called value and so on.
    How can I do it ?
    Thanks

    shubham
    i made this logic, i havent compiled or checked the code so forgive any typos or syntax errors
    Vector nameV=new Vector();
    Vector valueV=new Vector();
    Vector descV=new Vector();
    int addTo=0;
    for (int i=0;i<resultSet.size();i++){
    if(resultSet.elementAt(i).toString().equals("NAME_FORMAT_TYPE")){
         addTo=1;
         continue;
         if(resultSet.elementAt(i).toString().equals("VALUE_FORMAT_TYPE")){
              addTo=2;
              continue;
         if(resultSet.elementAt(i).toString().equals("DESCRIPTION_FORMAT_TYPE")){
              addTo=3;
              continue;
         switch (addTo) {
         case 1:
              nameV.addElement(resultSet.elementAt(i));
              break;
         case 2:
              valueV.addElement(resultSet.elementAt(i));
              break;          
         case 3:
              descV.addElement(resultSet.elementAt(i));
              break;
    Another way to do the same wud be ...
    int i1=resultSet.indexOf("NAME_FORMAT_TYPE");
    int i2=resultSet.indexOf("VALUE_FORMAT_TYPE");
    int i3=resultSet.indexOf("DESCRIPTION_FORMAT_TYPE");
    int i=0;
    for(i=1;i<i2;i++)
         nameV.addElement(resultSet.elementAt(i));
    for(i=i2+1;i<i3;i++)
         valueV.addElement(resultSet.elementAt(i));
    for(i=i3+1;i<resultSet.size();i++)
         descV.addElement(resultSet.elementAt(i));
    i hope i understood your problem correctly hope u can compile and check the outcome
    best wishes & regds

  • How can i know the size of ResultSet???

    i run a statment
    ResultSet rs = cs.executeQuery();
    rs.next();
    rs.getString(i) ; <-------------------- how can i know what is the max i can i get???????
    i didn't find function that returns the size of it !!!!!!!!!!
    any one can help me

    u want to know the number of rows returned or size of columns?

  • How to set the fetch size for a ResultSet object?

    Connection con  = getConnection();
    Statement stmt = con.createConnection();
    ResultSet res = stmt.executeQuery("select * from table");
    //res.setFetchSize(?);
    while (res.next)
    res.get....
    }I do not know the number of rows .
    How can I set the fetch size for the ResultSet object?
    I try
    res.last();
    res.setFetchSize(res.getRow()/2);
    res.beforeFirst();
    while (res.next)
    res.get....
    }but it's so slow if there are 6000 rows.
    How can I set the fetch size for the ResultSet object more effectible?
    And what is the best number to set the fetch size?

    The fetch size defaults to a standard number. It is unlikely that it will be any faster if you set it unless you only plan to read a small number of rows.
    i.e. if you are going to read all the rows, you need to read all the rows no matter what.
    Unless the system has set the fetch size to 1 changing it will not be faster.
    Depending on the row length, reading in 6000 rows is going to take a long time. You could try using a cpu profiler to improve performance.
    Do you really need to read everything in every row?

  • Please tell me if there is a size limitation for ResultSet

    Hi,
    I have a sql select * from....and the following code. If I limit the rows from the query results(rows 1 to 500), there is no problem. But if I get all the query results once , the ResultSet line get error message OutOfMemoryError. (I have large html infor. in the query result).
    So my question is if there is a size limitation for ResultSet? Do I have to break down the query results?
    PreparedStatement st = conn.prepareStatement(sql.toString());
    ResultSet rs = st.executeQuery();Thanks in advance,
    Katie

    Hi,
    Thanks for the link, but I didn't see any answers for
    my question.....my question is if there is a way that
    ResultSet hold all the query results?
    Thanks again,
    KatieDid you read this part:
    " Result Set Limitations and Downgrade Rules
    Some types of result sets are not feasible for certain kinds of queries. If you specify an unfeasible result set type or concurrency type for the query you execute, the JDBC driver follows a set of rules to determine the best feasible types to use instead.
    The actual result set type and concurrency type are determined when the statement is executed, with the driver issuing a SQLWarning on the statement object if the desired result set type or concurrency type is not feasible. The SQLWarning object will contain the reason why the requested type was not feasible. Check for warnings to verify whether you received the type of result set that you requested, or call the methods described in "Verifying Result Set Type and Concurrency Type".
    - There was a part after that that also talked about work arounds.

  • Getting size of ResultSet Object

    Is there any effective way to retrieve the size of ResultSet object while the type of the ResultSet itself is a default one (TYPE_FORWARD_ONLY) ?

    Maybe I was a little harsh ...or lazy to type anything. I don't think there are any efficient ways to count the number of rows in a ResultSet(for scrollable, forward only, etc)
    You could do the following:
    rs= statement.executeQuery("select count(column1) from table1 where column1<100");
    rs.next();
    long recordCount = rs.getLong(1);
    before executing your real query
    rs = statement.executeQuery("select column1 from table1 where column1<100");
    while rs.next.....
    Jamie

Maybe you are looking for

  • Oracle 8i installation on RedHat Linux 7.3

    Hi, I'm having a tough time installing Oracle 8i Ent Ed on Redhat Linux 7.3. At first it was giving me this error and nothing else : Initializing Java Virtual Machine from ../stage/Components/oracle.swd.jre/1.1.8/1/DataFiles/Expanded/linux/bin/jre. P

  • IPod isn't recognized by Computers

    This just started happening the day earlier. When I plugged in my iPod onto my computer, it was completely out of power. When it was plugged in, instead of the usual "Do not Disconnect" screen, with the stop symbol, it instead turned the main menu gr

  • In Mac OSX Firefox is hanging when trying to save files forcing restart - related to Google Chrome Script possibly

    When saving files from within Firefox sometimes, I get a pop up dialog message saying "Warning Unresponsive Script". The script it refers to is "chrome:global/content/bindings/general.xml:0". I am usually running Chrome at the same time cause I use d

  • ASM not starting up

    ASM is not starting up on couple of nodes with error Maximum Tranmission Unit (mtu) of the ether adapter is different on the node running instance 3, and this node. Ether adapters connecting the cluster nodes must be configured with identical mtu on

  • Functional Module for changing the field Reference Key 2 in Tcode FB02

    HI, I have a one requirement to change a field Reference Key2 (XREF2) in transaction FB02. This field appears in FB02 during (refer steps below): u2022 In Initial screen after entering the Document Number, Company code &  Fiscal Year then click on u2