How to display result of database query in JFrame?

How to display result of oracle database query in JFrame?
This is part of my code:
String username, password;
          DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
          OracleConnection conn = DriverManager.getConnection(String url, String username, String password);
Statement s= conn.createStatement();
ResultSet q= s.executeQuery("SELECT A, B, C FROM TABLE X");
Forget what url, username & password are. Is there any problem with my code?
What should be next if I want to display result of the query in a table in JFrame?Thx !

How to create JTable with unknown no. of rows? How to get no. of rows of a query?
I saw the demo of creating JTable on java.sun.com but the the table has a certain no. of rows which is not applicable to my case.
Suppose the result of query is a table with 3 attributes so there are 3 columns in the table.
R contains the result of the query.
Should it be something like this if I want to create JTable of the query?
How to make n rows of {R.getString(1),R.getString(2),R.getString(3)};?
public SimpleTableDemo() {
super(new GridLayout(1,0));
String[] columnNames = {"A",
"B",
"C",
while (R.next())
// content of a row
Object[][] data = {R.getString(1),R.getString(2),R.getString(3)};
I can't run it because I still can't debug my code which is said before.
Thx!

Similar Messages

  • How to display result of a query in browser?

    I have to write a simple application where I use EJB to access a database and then use Servlet/JSP to display the data to a browser. can anyone help me out please?

    in my ejb i am taking the input as claim number and using a select query i am getting the row for the particular claim number from the database. Through a servlet i need to invoke the ejb and get the data(result of the query) displayed in a browser. I want to know a way to display the query result in the browser.

  • How to compare result from sql query with data writen in html input tag?

    how to compare result
    from sql query with data
    writen in html input tag?
    I need to compare
    user and password in html form
    with all user and password in database
    how to do this?
    or put the resulr from sql query
    in array
    please help me?

    Hi dejani
    first get the user name and password enter by the user
    using
    String sUsername=request.getParameter("name of the textfield");
    String sPassword=request.getParameter("name of the textfield");
    after executeQuery() statement
    int exist=0;
    while(rs.next())
    String sUserId= rs.getString("username");
    String sPass_wd= rs.getString("password");
    if(sUserId.equals(sUsername) && sPass_wd.equals(sPassword))
    exist=1;
    if(exist==1)
    out.println("user exist");
    else
    out.println("not exist");

  • Unable to display results of multiple query in grid in Oracle SQL Developer

    Hi, I am a newbie to this forum and couldn't find the Oracle SQL Developer forum so posting it here.
    My question: How to display multiple query results in grid in Oracle SQL Developer.
    Example:
    select * from Employee;
    select * from Department;
    - when I select both the queries and hit F5 in Oracle sql developer. By default it displays in output window.
    - How to display result of both the queries in Grid.
    Any thoughts on this would be really helpful.
    Thanks in advance.
    Harsh

    Hi Harsh,
    I'd say that the Results grid is designed to only show the results of 1 query at a time. I don't know/can't see how it would display multiple queries at a time.
    I would suggest either joining your tables to create a single query or opening another SQL Worksheet for one of the queries so that you can display the results side-by-side.
    Maybe you could explain what you're trying to do. Why are you trying to display multiple results in the same query grid?

  • How to display current date in query header?

    Hi,
    How to display current date in query header?
    I use Query Designer for development.
    Thanks,
    Arun KK

    Hi Arun,
    You can define fixed header lines and footer lines so that when you generate the query list, they can receive current values of certain fields. When you define a header line or a footer line, you must specify a character string of the type &field, where field is the short name of a field.
    This function allows you (for example) to place a sort criterion in the header line.
    You can include the following fields as variables in the headers directly:
    %NAME
    Name of the user processing the query
    %DATE
    Current date
    %TIME
    Current time
    %PAGE
    Current page number (6 characters)
    %P
    Current page number (3 characters)
    These fields can be used in the short forms N,D,T and P. If you want to use these letters as short names for query fields, the field values from the query are used.
    You can also see the link
    [http://help.sap.com/saphelp_nw70/helpdata/EN/6e/dd68721faf11d6b1d500508b6b8b11/frameset.htm]
    Regards,
    NR

  • How to display items from database using catagorylookupdroplet

    Hi everyone,
    i want to know how to display items from database using catagorylookup droplet. if anybody have any code snippet please share it.
    Thanks in advance,

    <dsp:droplet name=".................../CategoryLookup">
         <dsp:param name="id" param="itemId"/>
         <dsp:oparam name="output">
              <dsp:valueof param="element.displayName"/>
                   <%-- This is show the Child Category --%>
                   <dsp:droplet name="......................./ForEach">
                   <dsp:param name="array" param="element.childCategories"/>
                   <dsp:oparam name="outputStart">Child Categories</dsp:oparam>
                   <dsp:oparam name="output">
                        <dsp:a href="">//bydefault it will take its own file's name
                             <dsp:param name="itemId" param="element.repositoryId"/>                                                                                          <dsp:valueof param="element.displayName"/>
                        </dsp:a>
                   </dsp:oparam>                                             
                   </dsp:droplet>
                   <%-- This is show the Child Product --%>          
                   <dsp:droplet name=".............../ForEach">
                        <dsp:param name="array" param="element.childProducts"/>
                        <dsp:oparam name="outputStart">Child Products</dsp:oparam>
                                  <dsp:oparam name="output">
                                       <dsp:droplet name="................/ProductLookup">
                                            <dsp:param name="id" param="itemId"/>
                                            <dsp:param name="elementName" value="Prod"/>
                                            <dsp:oparam name="output">
                                                 <dsp:getvalueof id="img102" param="Prod.smallImage.url" idtype="java.lang.String">
                                                      <dsp:img height="250" width="250" src="<%=img102%>"/>
                                                 </dsp:getvalueof>
                                            </dsp:oparam>
                                       </dsp:droplet>
                                       <dsp:a href="productView.jsp">
                                            <dsp:param name="itemId" param="element.repositoryId"/>
                                            <dsp:valueof param="element.displayName"/>
                                       </dsp:a>
    Hope this helps.
    -RMishra

  • Display results of MySQL query from AMFPHP by ArrayCollection in AS3 (Flash CS4)

    Hi, i am using Flash CS4 (AS3) + AMFPHP + MySQL to do own flash frontend for Wordpress CMS.  Everything is going fine but i`ve got one problem. Problem with properly display of result of query in AS3 by using ArrayCollection.
    When i check my service in "amfphp/browser/" in web browser i`ve got this (with all needed data):
    (mx.collections::ArrayCollection)#0
    filterFunction = (null)
    length = 2
    list = (mx.collections::ArrayList)#1  
    length = 2     source = (Array)#2
    That is the reason that i suppose that service work fine.  Problem is when i try to display result in AS3. In actionscript i have got this:
    function getNewsListHandler(result:Object):void{
    trace(result);
    This function displays: [object Object].
    I know that "result" is an ArrayCollection type but i don`t know how to get rows and columns from this. I know that my data is there but i have no idea how to get it.
    Clarify: I don`t know how to get to Arrays and simple data variables which are in ArrayCollection.
    Could anyone help me with that problem. I would be gratefull
    P.S. I tried also change query type in service.PHP for mysql_fetch_query but in that case i`ve got only one row (not all data).

    Thanks for fast reply,
    arr_coll:ArrayCollection = new ArrayCollection ({col1:"data1",col2:"data2"}, {col1:"data3",col2:"data4"});
    you would get the data like
    var resultstr:String = arr_coll[1][1].col2;
    trace(resultstr);
    //results in data4
    could you explain me how it was happen (arr_coll[1][1].col2)? It`s not clear to me. I thought in this case rather something like this :
    var resultstr:String = arr_coll[1]['col2'];
    It should give me "data4". I know it wasn`t but i don`t understand ArrayCollection in level which is needed to use your advice in my case. Could you clarify "arr_coll[1][1].col2" a bit?
    What would it look like when you would have something like this:
    arr_coll:ArrayCollection = new ArrayCollection ({col1:"data1",col2:"data2"}, {col1:"data3",col2:"data4"},{col1:"data5",col2:"data6"},{col1:"data7",col2:"data8"});
    and you would want know f.e. position in ArrayCollection of  "data6". How would you code this? arr_coll[1][2].col2?

  • How to get result of select query from  oracle  in VC

    Dear All ,
    I have a application in oracle which insert the data in the oracle database table.
    Now i want to show all the data that has been inserted into the database table in my VC application but i don't know how to handle select query in VC.
    Regards
    Krishan

    Hi Goivndu
    Thanks for your reply .
    I know all those things.
    I have created the system & alias  for my backend oracle system.
    I can also see all the stored procedure that are there in my oracle system.
    I just want to know how to write a select query in a stored procedure .
    you can insert data , Update data through oracle procedure but i don't think there is any way to get the result of select query in stored procedure .
    If you know any way to do that please do let me know .
    Regards
    Krishan

  • How to display image in database using php

    i've try search all hope that you all can give me some guidance how to display data that is in image or BLOB using PHP. just a query and php code that will make display of the image. hope that you all show me the example or give me reference that i need to solve my problem.

    Hi,
    Have a check on these Google results, you might find something there...
    http://www.google.com/search?sourceid=navclient-ff&ie=UTF-8&q=%22display%20image%22%2Boracle%20%2Bphp

  • Displaying results of a query

    Hi there
    I want to display the results of a query.
    OK I do kow how to do that. I do have one long text field
    (MySQL) and in some cases the colomn I iwsh to display has a page
    of information. I just want to display say the first 300
    characters. I was initionally thinking rtrim or trim but tralise
    that doesnt do it.
    I cant find what the correct term is.
    Thanks in advance

    Actually, I believe the Right() function returns the last
    part of the text, you will want to use the Left() function to
    return the first part. . . .
    http://livedocs.macromedia.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/js/html/wwhelp.htm?hre f=00000617.htm
    -Mike

  • How to use Results from Another Query for SAP BW universes

    Hi Everyone,
    I have two SAP BI universes.In my First universe I have Sales Doc no (dimension) and Orderqty (Measure) and in my second universe I have Sales Doc no(Dimension) and BillQty (Measure).
    Here in my first dataprovider I have 1200 rows of data and in second dataprovider I have 75,000 rows. The report should fetch only the BillQty details that matches to corresponding  Sales doc no in first data provider.
    I want to place all these fileds into a single report like as shown.
    (Datarpovider1)                (Datarpovider1)                    (Datarpovider2)
    *Sales Doc No*               Orderqty                           BillQty
    Here I am able to generate single report using merge dimension but it is leading to performance issues. I want to restrict the values at query level by passing the First dataprovider Sales doc no to second Data provider Sales doc number using Results from Anothery Query feature so that It can fetch only the matching records.
    I tried it but it was giving the follwing error:
    A filter contains a wrong value. You cannot run this query. (Error: WIS 00007)
    How Can I get rid of this error. Can we use Results from Anothery Query option for OLAP universe. Are there any limitation on it.
    All this I am doing in Webi Rich Client.
    Appreciate your help
    Thanks &in Advance
    Kiran Saka

    Hi Kiran,
    I think the filter has a wrong operand. For example, a filter with an empty constant, or a filter that deals with numeric values is defined with an alphanumeric value.Check out for this.
    Regards,
    Neeraj

  • How to present result of DB-Query blasting all formats in width

    Hi,
    i'm searching for an idea/solution for the problem:
    Users of my form shall be able to choose an item of a result list of a DB-Query. Unfortunatelly there are too many attributes with alternating length per line, that have to be showed there. Using multiple line per tuple would blast the form in length instead of width, which is not acceptable, too. Something for scrolling within a little window would be most appropriate.
    Nevertheless there is not a table object at all in Designer, as i read in this forum. (This is to my mind a real lack of function. Maybe a new version might offer this?)
    Currently i'm developing the form as a test for pdf. Later on the forms shall be developed for HTML as soon as the Form Server 7 is available and implemented.
    Maybe somebody has thought about the same problem or has an idea how this could be solved.
    Thanks in advance for any response
    Kermit
    Kermit

    Hi Goivndu
    Thanks for your reply .
    I know all those things.
    I have created the system & alias  for my backend oracle system.
    I can also see all the stored procedure that are there in my oracle system.
    I just want to know how to write a select query in a stored procedure .
    you can insert data , Update data through oracle procedure but i don't think there is any way to get the result of select query in stored procedure .
    If you know any way to do that please do let me know .
    Regards
    Krishan

  • How to display results set of multiple reports into a single report table

    Our goal is to create a single report (or dashboard) that shows the "funnel" of object creations related to each campaign. The flow goes from Activity to Lead to Opportunity as well as multiple steps within each (ie. Unqualified Lead -> Qualified Lead, etc).
    We currently have 3 separate reports in three different subject areas, each reporting the different metrics and we would like to combine the output into a single Unified report.
    For example what we currently have is:
    Activities:
    Campaign Name # of Activities
    Campaign A 12
    Campaign B 26
    Leads:
    Campaign Name # of Leads # of Qualified Leads
    Campaign A 10 4
    Campaign B 20 18
    Opportunities:
    Campaign Name # of Opportunities # of Opps per Sales Stage ... # of Wins Closed Revenue
    Campaign A 3 2 1 $1,000.00
    Campaign B 10 8 3 $2,800.00
    What we want to see is:
    Combined:
    Campaign Name - Campaign Cost - # of Activities - # of Leads - # of Qualified Leads - # of Opportunities - # of Opps per Sales Stage - # of Wins - Closed Revenue
    Campaign A - $423.00 - 12 - 10 - 4 - 3 - 2 - 1 - $1,000.00
    Campaign B - $ 1,000.00 - 26 - 20 - 18 - 10 - 8 - 3 - $2,800.00
    We have tried using the "Combine with similar analysis" but the number of columns for each subject area differ. We also tried creating multiple UNION criteria (one for each column), but in the case of # of Opps per Sales Stage and Closed Revenue, those are not "Metrics" fields, so they won't combine.

    Hi, You may have to create some dummy fields to equate the no. of field in each of the report matching the data type too and get a one single report using combined analytics and then using the resultant data you can create a simple pivot like below. Haven't tried it before
    -- Venky CRMIT
    Hi Venky,
    I am facing the same problem. Can you please say Steps how to create resultant data and Combine in pivot Table .
    Please Help me .
    Thanks in Advance .
    My mail id is :
    [email protected]

  • How to display records from a query into non-database field

    Hi
    I a have a problem:
    I have a query with many tables and 6 column(select a,b,c,d,e,f from x,y,z,t,s,g where conditions) and I use 3 parameters.
    I create 3 parameters :datai,:dataf and :partener and a button with a trigger when button is pressed.
    Then a create a manualy block with six field non-database a1,b1,c1,d1,e1,f1.
    Now I want to display all the records from my query into a1,b1,c1,d1,e1,f1 where a1=a,b1=b,etc. and all the records (if I have 20 record, it will display 20 records in non-database field) when I press the button.
    How I made:
    I create a cursor with query then
    begin open cursor
    loop
    fetch cursor into :a1,:b1,:c1,:d1,:e1,:f1;
    end loop;
    close cursor;
    end;
    It display one record in a1,b1,c1 only and it have to display 100 records and are date for all the fields.
    Can somebody help me in this problem?
    Thanks.
    Edited by: 928437 on Oct 1, 2012 2:55 AM

    Creating a view, and querying that into a database block is an excellent solution.
    To use the non-database block:
    You're missing the all-important Next_Record; command.
    <pre> Begin
    Go_block('X'); -- block X is the non-database block
    Clear_Block(No_Validate);
    open cursor X1;
    loop
    If :System.Record_status != 'NEW' then
    Next_Record;
    End if;
    fetch X1 into :a1,:b1,:c1,:d1,:e1,:f1;
    Exit when X1%NOTFOUND;
    end loop;
    close X1;
    end;</pre>

  • How to display results of a report based on current year

    Hi,
    Please advice me for the following requirement.
    I have a report which is having sales results, which is having year column also. Report has to be displayed based on the current year. Now it is 2013. I should show current year results only i.e 2013.
    In 2014, i should show only 2014 results. How to achieve this at a report level.
    regards
    CK.

    Hi CK,
    You are having Data for 2014 also. If not means, you can use sql query select max(year) from period.
    So it will show the final maximum end of the year(2013) from database.
    You can use dashboard prompts too. in the prompt also you can have specific year or sql query
    http://mkashu.blogspot.com
    Regards,
    VG

Maybe you are looking for

  • Uploading classical music (large files)

    Hi everyone. I'm having trouble uploading classical music from my MacBook to the iphone via itunes. Uploads all contemporary music, but won't bring the larger classical music files across. I can see the classical music albums in my itunes playlists a

  • Pacman cannot find i3-wm [Solved]

    Hello... several weeks ago i installed archlinux and few days ago i update the pacman database and upgrade the whole system. At that time i only had basic archlinux install with no x-server. Today i wanted to try i3 window manager, but when i try to

  • SQL Loader UTF8 Charset  issue

    Hi, My database charset is UTF8, NLS_LANG parameter on mid tier (unix) is UTF8. I have created a spool file (Korean language) in UTF8 charset. Also, verified the dat file using a unicode text editor. When I am trying to upload data back to the databa

  • Missing Apple menu after upgrade to 10.5.2

    What should I do?

  • CJS-30023 brconnect.log

    I am installing ECC 6 on Win 2003 Oracle 10G. I am getting following error message during installation. ERROR 2008-01-07 13:21:35 CJS-30023  Process call 'F:\usr\sap\IDS\SYS\exe\uc\NTI386\brconnect.exe -u / -c -o summary -f stats -o SAPSR3 -p 2' exit