Java WS for query results

All, new to Java from .NET and building a web service on a 3tier application. The client dynamically builds a query string and sends to the WS which is supposed to query the backend Oracle 10g database and return the resultset to the WS which sends back to the client. Okay, I can do simple strings just fine, but when I build the WS with a complex return type (ResultSet, Vector, String[][]) I can not get either the WS to compile or the proxy creation in JDeveloper to work. Any thoughts on how to solve this is appreciated.

Thank you for your response. How would you suggest I send the results of a SQL Query back to the client from a web service that uses JDBC to call the DB for a resultset? XML seems like a good choice, but when it gets to the client from the WS, how would I load the XML string (of the resultset) into a JTable?

Similar Messages

  • BEX Query - Run time char InfoObjects manipulation for query results

    Hello Experts,
    Iam working on BEX queries to meet following requirements,
    1)  Display only first 2 char of an InfoObject in the query results. Actual infoprovider has 24 char for this InfoObject. Example: Summary code FABCDXXXX.. But we want to show only 'FA' in query results
    2) We split a 120 char description into two 60 char InfoObjects, we need to concatenate the split char into one for query result display
    3) We need to show a specific hierarchy level, nothing before or after. For example: Eighth level for a cost element hierarchy.
    4) We need to show a constant in a column (which is not there in the table)
    We are planning to use both BEX analyzer and Crystal for the reports.
    I read in one of the thread that we can use formula variables/Customer exit for this but iam not very clear, if you know how to do it or if you have any step by step procedure, can you please pass it to me. Thanks in advance for your help.
    Regards,
    Raman

    Thanks for quick response. We have users who need BEX analyzer, is there any way to handle the above requirments for BEX analyzer.

  • How to print nicely for queried results

    If my query returns something like the following:
    USERNAME SID SERIAL#
    MACHINE
    PROCESS PROGRAM
    TYPE TERMINAL
    my_user 131 29390
    my_machine
    1234 JDBC Thin Client
    USER unknown
    On the terminal, it is shown exactly as I pasted above. It is a messy format. Is there any "relatively simple" way to make it formatted more nicely, rather than using a lot of "COLUMN ... FORMAT ..." with a lot of thinking its field width? And hopefully return that record on a single line?
    Thanks a lot.

    user3789189 wrote:
    If my query returns something like the following:
    USERNAME SID SERIAL#
    MACHINE
    PROCESS PROGRAM
    TYPE TERMINAL
    my_user 131 29390
    my_machine
    1234 JDBC Thin Client
    USER unknown
    On the terminal, it is shown exactly as I pasted above. It is a messy format. Is there any "relatively simple" way to make it formatted more nicely, rather than using a lot of "COLUMN ... FORMAT ..." with a lot of thinking its field width? And hopefully return that record on a single line?
    Thanks a lot.Can you try getting the report in form of a html document? In that case the result will be more readable is what I feel.
    Krishna

  • Need to specify date range for query result.

    Below is my query. The query as is is working fine. The columns 'totalCalls' , 'totalOrders' and 'totalSCs' are all stored by date. I have created a form where the user can specify a start and end date. How would I change this query to report within those specified dates.
    <cfquery name="qZVPData_Western" datasource="xxxxxx">
    SELECT UserID,
           TMName,
        UserZone,
        AVG(WeekCallGoal) AS WCG,
        AVG(QTCallGoal) AS QTCG,
              (SELECT COUNT(*)
               FROM Sales_Calls
               WHERE Sales_Calls.UserID = u.UserID) as totalCalls,
        (SELECT COUNT(*)
         FROM Orders
         WHERE Orders.UserID = u.UserID) as totalOrders,
        (SELECT SUM(Quantity)
         FROM ProductOrders PO
         WHERE PO.UserID = u.UserID AND PO.NewExisting = 1) as newItems,
        (SELECT SUM(NewExisting)
         FROM  ProductOrders PO_
         WHERE PO_.UserID = u.UserID) as totalNew,
        (SELECT COUNT(ServiceCall_ID)
         FROM  ServiceCalls SC
         WHERE SC.UserID = u.UserID) as totalSCs,
        (SELECT COUNT(UserID)
         FROM  TMStatusLog TSL
         WHERE TSL.UserID = u.UserID AND TSL.Status = 'Vacation') as TSLdays1,
        (SELECT COUNT(UserID)
         FROM  TMStatusLog TSL
         WHERE TSL.UserID = u.UserID AND TSL.Status = 'TradeShow') as TSLdays2,
        (SELECT COUNT(UserID)
         FROM  TMStatusLog TSL
         WHERE TSL.UserID = u.UserID AND TSL.Status = 'Admin Day') as TSLdays3,  
        SUM(TSLdays1)+(TSLdays2)+(TSLdays3) AS TSLdays,   
        SUM(totalOrders)/(totalCalls) AS closePerc,
        SUM(totalOrders)/(totalCalls) - (.30) AS GRV,
        SUM(totalSCs)+(totalCalls)-(QTCG) AS PerVar,
       (SUM(totalSCs) + totalCalls + (TSLdays*WCG/5))/QTCG AS PerCalls
    FROM Users u
    WHERE UserZone = 'Western'
    GROUP BY UserZone, UserID, TMName
    </cfquery>
    I figured I could add this to the columns WHERE statements;
    'AND Column BETWEEN #FORM.Start# AND #FORM.End#' but this isn't working.
    Any ideas???

    What is the SQL being generated by your <cfquery> contents?  Is it valid SQL?  This is always the first thing to check when you get SQL errors back from the DB... check what you're sending to the DB.
    Second: don't hard-code dynamic values into your SQL string, pass them as parameters.
    Re all the subqueries: it runs fine in dev. Have you tried to load test it?  If poss move your subqueries to the FROM statement, as then they're only run once per recordset. As opposed to once per row of the result set, when the subqueries are in the SELECT or WHERE statement.
    Adam

  • Query Results not coming for SELECT * in sql developer 3.1.07

    VERY FRUSTRATING to use sql developer.
    In SQL DEVELOPER 3.1.07:
    WHAT WORKS: select sequence# from v$archived_log
    WHAT DOESN'T WORK : select * from v$archived_log
    You've got to be kidding me.
    I wish I can show a screenshot, but can't in this forum. Here's my description:
    When I run the query, in the bottom frame for Query Results, it just says: Executing: select * from v$archived_log in 0 seconds.
    Then there's no result grid.
    WOw

    >
    This was when connected to a standby db that's in mount state
    >
    Is this a 'manual' standby db? Are you using Data Guard?
    Post the results for what Gary ask of running the queries in sql*plus. If those queries give the same result then this is NOT a sql developer issue.
    Review the following thread and post back with what information in it applies to your use case.
    Re: V$ARCHIVED_LOG returns no rows on manual standby
    If you are using Data Guard you may want to cross-post in that forum.

  • Multiple Query Result tabs

    Is it possible to have a new Query Result tab opened every time a query is run instead of overwriting the current contents of the window Query Result tab?
    thanks,
    Louis

    Hi Louis,
    Welcome to the forum. Here is a thread with some posts telling you how to control this, both for Query Results and the Object Viewer:
    Re: SQL Developer no longer letting me look at the same table name on 2 servers
    Regards,
    Gary

  • Enh request: add Export for sql results of worksheet

    Please implement "Export" on right-click in sql worksheet results (shown after running a query), in a similar way TOAD does.
    Export should save all query results (not just the ones shown in worksheet) in the format specified by user (tab-delimited, OpenOffice Spreadsheet etc), including column name.
    OpenOffice Spreadsheet would add formatting to spreadsheet columns based on database columns data type and would but the colum names (1st row) in bold, as TOAD does with export to Excel.
    Note that current Select All, Copy and Paste in a separate file doesn't work for all rows, doesn't add any formatting and has problems on some rows (breaks tab-delimiting).
    Thank you

    Thank you for your reply Frank.
    This won't solve the issue. An export option on right-click would be more useful, as it can have more options and would include column headers. Some formats to support at the begining:
    * tab-delimited text file
    * open spreadsheet document
    http://www.oasis-open.org/committees/office/faq.php
    (this one would auto-format the column contents to date, numbers etc. depending on column types in database)
    I'd like similar functionality with TOAD's "SaveAs" option for query results, which must be licensed/installed separately now to complement JDeveloper.
    This functionality can be reused in JDeveloper to export data in tables browsed in Connections Navigator.

  • SSMS Addin - How To Access Query Results Grid

    Hi,
    I want to access Query Result Grid(Results) in SSMS addin but I did'nt found anything.
    How can I access Query Result Grid, Rows, Columns and Cells when I executed a script?
    Thanks.

    SQL Server Management Studio currently supports query execution results to be displayed in three different ways: Results to Grid,
    Results to Text and Results to File.
    By default SQL Server Management Studio is configured to display query results in
    Grid format.  If you want to change the default to some other option follow these steps.
    1. In SQL Server Management Studio, under Tools menu, click
    Options as shown in the snippet below.
    2. In the Options dialog box, expand Query Results, expand
    SQL Server and then select General as shown in the snippet below. In the right side panel choose one of the three options shown below in the
    Default Destination for results drop down list and click
    OK to save the changes as shown in the snippet below. The changes will go into effect once you open a New Query window.
    Query Result Options for Results to Text
    In this format you have the option to display the results in a different tab as well as setting different output options.
    In the Options dialog box, expand Query Results, expand
    SQL Server and then select Results to Text tab as shown in the snippet below. In the right side panel first select the checkbox for
    Display results in a separate tab and then select the checkbox for
    Switch to results tab after the query executes and then click
    OK. If you would like to also display the column name in the result set then choose the option Include column headers in the result set
    as shown in the snippet below.
    The options you can use in the Text format are:
    Output format: - In the above snippet you could see that by default the output is displayed as columns aligned. Some of the other options that are available are Comma Delimited,
    Tab Delimited, Space Delimited and Custom Delimited. If you choose the Custom Delimited option in the Output format drop down list then you need to specify a character of your choice for the delimiter in the
    Custom delimiter text box.
    Include column headers when copying or saving the results: - If this option is selected, then whenever the results are copied to clipboard or it is saved to a file the column headers are also copied along with the results.
    Include the query in the result set: - The text of the query is displayed as part of query output under the messages tab.
    Scroll as results are received: - If this option is selected, then the display focuses on the most recently returned records at the end of the results set.
    Right align numeric values: - If this option is selected, then numeric values will be aligned to the right of the column.
    Discard results after query executes: - If this option is selected, then the query results are not displayed in the reviewing pane.
    Display results in a separate tab: - If this option is selected, then the result set after query execution will be displayed in a new tab instead of at the bottom of the query window.
    Switch to results tab after the query executes: - If this option is selected, then after the query execution the screen focus will be set to the results tab.
    Maximum number of characters displayed in each column: - This sets the maximum characters to display for any one column.  So if you have a column that is 500 characters this will only show the first 256 if you keep the default setting.
    Ref link :http://www.mssqltips.com/sqlservertip/2346/different-options-for-query-results-in-sql-server-management-studio/
    Ahsan Kabir Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread. http://www.aktechforum.blogspot.com/

  • How to create 'Query Result Object' entity?

    Hi Gurus,
    I have come across a situation where i need to create an entity [not a value node] of object type 'Query Result Object', and set the values.
    Its possible to create an entity of type 'Root object', but was not able to find a way to create other object types.
    Please find below, the details of the query result object:
    Component: CRMAUI
    Object: AUIHANAQR
    Object type: Query Result
    Attribute Structure: CRMS_AUI_SRCH_RESULT_HANA
    The above entity is part of the collection which in turn is the result set of a dynamic query search. Due to a particular requirement, we need to add some more entries of the same object type in the result in the 'search event' itself.
    Please find below, the details of the corresponding dynamic query object:
    Object: AUIQueryHANA
    Object type: Dynamic Query
    Kindly let me know if you have come across such situation before and please share the solution if you have any.
    Your help will be much appreciated.
    Thanks and regards,
    Arun N  K.

    Hello,
    In fact there is not really entities for query result object, it's entries in the result table.
    So you need to modify the search to add more results, usually there are some badi to do so, or maybe you can extend the class used to perform the query in order to add some results.
    Regards,
    Benoît

  • Error occurred while sending query result: 'java.lang.NullPointerException'

    I am doing end to end scenario from SQL server to File
    JDBC --XI -- File
    I am getting the following Error while monitoring the sender CC in RWB
    "Error occurred while sending query result: 'java.lang.NullPointerException'
    Please Help !!

    Hi,
    To see the Adapter Error log, try:
    http://<XiServerHostName>:<J2EE-Port>/MessagingSystem
    Try viewing the Audit Log for each message (Newspaper Icon)
    Regards,
    Amitabha

  • Converting Oracle XML Query Result in Java String by using XSU

    Hi,
    I have a problem by converting Oracle XML Query Result in Java
    String by using XSU. I use XSU for Java.
    For example:
    String datum=new OracleXMLQuery(conn,"Select max(ps.datum) from
    preise ps where match='"+args[0]+"'");
    String datum1=datum;
    I become the following error:
    Prototyp.java:47: Incompatible type for declaration. Can't
    convert oracle.xml.sql.query.OracleXMLQuery to java.lang.String.
    Can somebody tell me a method() for converting to solve my
    problem??????
    Thanks

    Hmmm.. Pretty basic just look at the example:
    OracleXMLQuery qry = new OracleXMLQuery(conn,"Select max(ps.datum) from preise ps where match='"+args[0]+"'");
    String xmlString = qry.getXMLString();
    Hi,
    I have a problem by converting Oracle XML Query Result in Java
    String by using XSU. I use XSU for Java.
    For example:
    String datum=new OracleXMLQuery(conn,"Select max(ps.datum) from
    preise ps where match='"+args[0]+"'");
    String datum1=datum;
    I become the following error:
    Prototyp.java:47: Incompatible type for declaration. Can't
    convert oracle.xml.sql.query.OracleXMLQuery to java.lang.String.
    Can somebody tell me a method() for converting to solve my
    problem??????
    Thanks

  • Create a CF Query Result Set in Java

    I'd like to programatically build a ColdFusion query resultset inside of a Java class and return it to the calling application.  See the Java psudocode below to see what I'm talking about:
    public class MyClass {
         public coldfusion.sql.QueryTable getQuery() {
              // Create a query table object
              QueryTable myTable = ..?
              // Loop through some set of instance data for my class
              for(int c = 0; c < this.myWigets.length; c++) {
                   int row = c+1;
                   myTable.setField(row, nameCol, this.myWigets[c].name);
                   myTable.setField(row, colorCol, this.myWigets[c].color);
              return myTable;
    I've had stuff like this partially working in the past but had issues with things like query of queries and such probably due to the hacks used to create the QueryTable object.  I'm mainly just checking in to see if there has been any progress made in this area.  To me this seems like such an obvious thing for a Java developer working within CF to want to do.  I'm surprised Adobe doesn't have an officially supported API for doing this sort of thing (or maybe I'm just too dumb to find it.)    A few other notes... I'm not using CFX, and I'm not starting with a java.sql.ResultSet otherwise I would use the QueryTable(java.sql.ResultSet) constructor.  I need to build this thing from scratch programatically.
    Thanks for your time.  I hope this question makes sense to someone out there.
    - Mike

    I appologize.  I wasn't very clear with my original question.
    I'm creating an instance of my Java class from within CF using createObject("java", "com.example.MyClass").  So based on the sample code in my original post on the CF side I'd like to do something like this:
    <cfscript>
         myObj = createObject("java", "com.example.MyClass");
         myObj.doSomeStuff();
         myCFQuery = myObj.getQuery();  // Return a CF query from my java class
    </cfscript>
    ... then do stuff like ...
    <cfquery name="mySortedQuery" dbtype="query">
         select     *
         from       myCFQuery
         order      by color
    </cfquery>
    I appriciate your suggestions so far.  I have other solutions working already but they are not ideal.  I was just hoping someone had a clean and as-hack-free-as-possible way of creating a ColdFusion query result set in Java and passing it back to CF.
    Thanks again,
    Mike

  • No data Found for Query with hierarchy in 2004S SP10 in JAVA Stack

    Hello,
    I have typical issue while running the simple query in ABAP Web and JAVA Web (RSRT) with One row and one column. The char in the row is restricted with external hierarchy.
    If I run in ABAP web, I get the results.
    If I run in JAVA Web, No data found message displayed.
    Does any one come across this issue. Tried to get SAP note but not clear solution.
    If any one give me information where I can find the values used for query variable in the dictionary tables I might help in my investigation.
    Advanced thanks.
    Ramana

    Hello,
    Sorry I missed a point.
    The char on which the hierarchy is resferencing char. Effectively using the hierarchy of referenced char.
    Thanks.

  • 0 result returned for query "collection ('exampledata.dbxml')/article

    I  using  BDB XML I create a container called Exampledata.dbxml using java API. using a separate program I put my sigmodRecord.xml  file into the container. I then wrote another program (see the program below) to test my Query
    where Query =  "collection ('Exampledata.dbxml')/article"  but dont know why i always have
                                                      0 result returned for query "collection ('exampledata.dbxml')/article  if  the program is run. Pls can anybody help me?
    package xmldbdemo;
    import com.sleepycat.db.Environment;
    import com.sleepycat.dbxml.*;
    import dbxml.gettingStarted.myDbEnv;
    import java.io.File;
    public class simpleQuery3 {
        public static void main (String[] args) throws Throwable  {
         String theContainer = "Exampledata.dbxml";
          File path2DbEnv = new File("c:/myJavaProgs/examplesEnvironment");
         if (path2DbEnv == null || ! path2DbEnv.isDirectory()) {
               System.out.println("Bad file name");
          System.exit( -1 );
      myDbEnv env = null;
      XmlContainer openedContainer = null;
         env = new myDbEnv(path2DbEnv);
                Environment enviro = env.getEnvironment();
         // create xmlmanager
           XmlManagerConfig myManagerConf = new  XmlManagerConfig();
           myManagerConf.setAdoptEnvironment(true);
           myManagerConf.setAllowExternalAccess(true);
           XmlManager myManager = new XmlManager  (enviro, myManagerConf);
       // XmlManager myManager = new XmlManager();
        XmlContainerConfig myContainerConf = new  XmlContainerConfig();
        XmlContainer myContainer = myManager.openContainer( theContainer, myContainerConf);
        XmlQueryContext myContext =  myManager.createQueryContext();
        String myQuery = "collection('Exampledata.dbxml')/article";
        XmlResults myResults = myManager.query(myQuery, myContext, null);
        XmlValue myValue = myResults.next();
        while (myValue != null){
         XmlDocument myDocument = myValue.asDocument();
         String name  = myDocument.getName();
         System.out.println(name);

    Hi,
    The BDB forum is located here : Berkeley DB Family

  • Serializing database query results for use as dataproviders

    I am executing my database queries in Java and passing my results to flex and creating a chart or datagrid based on the results.  The problem is, I don't know how to code this in Java in a way that flex would understand it.  For instance, Flex wants:
    <mx:DataGrid id="dg"  dataProvider="{myArray}">
      <mx:columns>
             <mx:DataGridColumn dataField="column1" />
             <mx:DataGridColumn dataField="column2" />
              <!-- etc ... -->
             <mx:DataGridColumn dataField="columnN" />
          </mx:columns>
    </mx:DataGrid>
    I need to create this table-like array in Java and have it readable as a dataprovider by flex.  I know about ArrayCollections and Java ArrayLists can be nicely converted to this in Flex, but I just don't know how to create them with a column1, column2, etc. when I don't know from query to query how many columns will be in my results.
    Any help would be greatly appreciated!

    You don't know in advanced the columns that your queries will return? 
    Or the number of records?
    Sincerely,
    Michael
    El 30/04/2009, a las 13:47, Cr99 <[email protected]> escribió:
    >
    I am executing my database queries in Java and passing my results to 
    flex and creating a chart or datagrid based on the results.  The 
    problem is, I don't know how to code this in Java in a way that flex 
    would understand it.  For instance, Flex wants:
    >
    <mx:DataGrid id="dg"  dataProvider="">
      <mx:columns>
             <mx:DataGridColumn dataField="column1" />
             <mx:DataGridColumn dataField="column2" />
              <!-- etc ... -->
             <mx:DataGridColumn dataField="columnN" />
          </mx:columns>
    </mx:DataGrid>
    >
    I need to create this table-like array in Java and have it readable 
    as a dataprovider by flex.  I know about ArrayCollections and Java 
    ArrayLists can be nicely converted to this in Flex, but I just don't 
    know how to create them with a column1, column2, etc. when I don't 
    know from query to query how many columns will be in my results.
    >
    Any help would be greatly appreciated!
    >

Maybe you are looking for