How to make SELECT ?

I'd like to select some rows from my table. I try sth like this:
music.addActionListener(new ActionListener() {             public void actionPerformed(ActionEvent e) {                 Base baza = new Base("MUZYKA");                 try {                     Statement stat = baza.conn.createStatement();                     ResultSet res = stat.executeQuery("SELECT * FROM dzielo");                     while (res.next()) {                         String tytul = res.getString("tytul");                         String rok = res.getString("rok_wydania");                         String gatunek = res.getString("gatunek");                         System.out.println(tytul + "\n" + rok + "\n" + gatunek + "\n");                     }                     System.out.println("----------------------------------------KONIEC");                     res.close();                     stat.close();                     baza.conn.close();                 } catch (SQLException ex) {                     System.out.println("Błąd w bazie danych.");                     System.out.println("Message:  " + ex.getMessage());                 }             }         });
This is my Base():
public Base(String op) {         String operation = op;         try {             Class.forName("oracle.jdbc.driver.OracleDriver");         } catch (ClassNotFoundException e) {             JDialog dialog = new DialogWindow(ramka, szerokoscEkranu, wysokoscEkranu, 250, 100,                     "<html>Po&#322;&#261;czenie zerwane.</html>", "Po&#322;&#261;czenie");             dialog.setVisible(true);             System.exit(1);         }         try {             conn = DriverManager.getConnection(connectionString, login,                     password);             System.out.println("Po&#322;&#261;czenie nawi&#261;zane pomy&#347;lnie: " + operation);         } catch (SQLException e) {             System.out.println("Po&#322;&#261;czenie zerwane: " + operation);             JDialog dialog = new DialogWindow(ramka, szerokoscEkranu, wysokoscEkranu, 250, 100,                     "<html>Po&#322;&#261;czenie zerwane.</html>", "Po&#322;&#261;czenie");             dialog.setVisible(true);         }     }
And console give me:
Po&#322;&#261;czenie nawi&#261;zane pomy&#347;lnie: MUZYKA ----------------------------------------KONIEC
What's wrong?

It looks like there weren't any records in the table "dzielo".
Are you sure you connected to the right database? Are you sure the table contained records? Are you sure that any operation that was supposed to insert records into that table had completed and committed its results?
If that doesn't help you might want to post more of the details of the Base class than just the constructor and to specify just what output you expected to see.

Similar Messages

  • How to make select list as read only

    Hi All.
    when i m loading a page ...how to make value of select list as read only ..
    i tried doing this ....
    i added readonly attribute to the select list's element attibute ...it is showing as read only field by darkening the select list field but ... the select list is editable even now... its allowing to choose from drag and drop ...
    Thanks & Regard ,
    Nandini

    I have the same requirment..
    I have a select list on a editable form and i want to make that one read only.
    When I use read only property it doent do anything. (But this is working for text items well).
    When I use "disabled' option it works fine. But then that value does not post when use POST the form. So making select list disabled is not a solution.
    Any Idea..
    Thanks
    mc

  • How to make Select Options Mandatory?

    Hi Guys,
                  Can anybnody tell me how to Declare  Selection Options for some of them mandatory.
    Select-Options : v_PurOrg for EKKO-EKORG default '2000',
                             v_GRDate for Sy-Datum ,
                             v_GRPrd  for MSEG-GJAHR.
             In these i have to make v_PurOrg Manadatory.
    Thanks,
    Gopi.

    Hi Gopi,
    In order to make select-options mandatory we add OBLIGATORY in the statement like the below.
    Selection-Screen.
    Select-Options : v_PurOrg for EKKO-EKORG default '2000' OBLIGATORY.
    In this case, only the first option will have the default value of 2000.But if you want both the options low and high of select-options, means you have to add the below code in your program in the initialization event.
    Initialization.
    v_PurOrg-low    =   1000. 
    v_PurOrg-high    =   2000. 
    append v_PurOrg.
    Hope this helps.
    Please reward if useful.
    Thanks,
    Srinivasa

  • How to make selection parameter gray out, not changeble mode

    Hi Experts,
      Selection screen having parameters, I am putting default values in that parametrs.
    How to make this parameter gray out, not changeable mode.
    Thanks in advance
    mahahe.
    See comments below
    Edited by: Rob Burbank on Jul 1, 2009 12:43 PM

    Hi,
    For the parameters required, while declaring them use the MODIF ID, lets say you have choosen the modif id as SC1.
    i.e. parametes: p_mat type matnr DEFAULT '100' MODIF ID SC1.
    Then in the initialization event, code as below.
        LOOP AT SCREEN.
          IF screen-group1 = 'SC1'.
            screen-input = '0'.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
    It will work.
    Regards,
    Nangunoori.

  • How to make selected and active a child row of a treeTable?

    Hello,
    I am inserting a new child row into a af:treeTable, disclosing it, but I can't figure out how to make it selected and active so the focus of the user to go on it.
    Jdeveloper version 11.1.2.3.0
    This is how I am inserting the child node:
    public void createLocation(RowIterator ri, Key selectedNodeKey) {
            final String locationCategoryViewDef = "model.views.LocationCategoryView";
            if (ri != null && selectedNodeKey != null) {
                Row[] found = ri.findByKey(selectedNodeKey, 1);
                if (found != null && found.length == 1) {
                    Row foundRow = found[0];
                    String nodeDefname = foundRow.getStructureDef().getDefFullName();
                    RowSet parents = (RowSet)foundRow.getAttribute("LocationView");
                    Row childrow = parents.createRow();
                    //hardcoded locationId
                    childrow.setAttribute("LocationId", 434558);
                    parents.insertRow(childrow);
    }  And this is the treeTable:
    <af:treeTable value="#{bindings.LocationCategoryView2.treeModel}" var="node" varStatus="vaarr"
                  partialTriggers="gaga gag4a ga4a"
                  selectionListener="#{bindings.LocationCategoryView2.treeModel.makeCurrent}"
                  displayRow="selected" rowSelection="single" id="tt1" editingMode="clickToEdit"
                  horizontalGridVisible="true" binding="#{pageFlowScope.treeTableBean.sampleTreeTable}">
        <f:facet name="nodeStamp">
            <af:column id="c5" width="15">
                <af:outputText value="#{node}" inlineStyle="display:none" id="ot1"/>
            </af:column>
        </f:facet>
        <f:facet name="pathStamp">
            <af:inputText value="#{node}" id="ot2"/>
        </f:facet>
        <af:column id="c2" headerText="Location CategoryName">
            <af:inputText value="#{node.LocationCategoryName}" inlineStyle="font-weight:900" id="ot45"/>
        </af:column>
        <af:column id="c6" headerText="Location CATID">
            <af:inputText value="#{node.LocationCategoryId}" inlineStyle="font-weight:900" id="ot6"/>
        </af:column>
        <af:column id="cgg2" headerText="Var INDEx">
            <af:outputText value="#{vaarr.index}"/>
        </af:column>
        <af:column id="c1" headerText="Location Name">
            <af:inputText value="#{node.LocationName}" id="ot3"/>
        </af:column>
        <af:column>
            <af:panelGroupLayout layout="vertical">
                <af:commandLink id="gaga" text="addLocation" inlineStyle="color:red"
                                action="#{pageFlowScope.treeTableBean.createChildren}"
                                rendered="#{node.LocationId == null}" partialSubmit="true"/>
                <af:commandLink id="gag4a" text="delete category" inlineStyle="color:blue"
                                partialSubmit="true" rendered="#{node.LocationId == null}"
                                action="#{pageFlowScope.treeTableBean.deleteChildRow}"/>
                <af:commandLink id="ga4a" text="delete location" inlineStyle="color:green"
                                partialSubmit="true" rendered="#{node.LocationId != null}"
                                action="#{pageFlowScope.treeTableBean.deleteChildRow}"/>
            </af:panelGroupLayout>
        </af:column>
    </af:treeTable>

    Yes I did now but nothing changes. The current, selected and active row is still the parent node...
    Even I am adding AdfFacesContext.getCurrentInstance().addPartialTarget(this.sampleTreeTable); for just in case..

  • How to make select-option for one inner table

    Hi,
    Who can teach me to  make select-option for a inner table, which let select-option display data from this inner table.
    Thanks in advance.

    Is this what you are looking for?
    report zrich_0002.
    data: begin of itab occurs 0,
          matnr type mara-matnr,
          spras type makt-spras,
          maktx type makt-maktx,
          end of itab.
    select-options: s_matnr for itab-matnr.
    select-options: s_spras for itab-spras.
    start-of-selection.
      select mara~matnr makt~spras makt~maktx
               into corresponding fields of table itab
                      from mara
                            inner join makt
                               on mara~matnr = makt~matnr
                                        where mara~matnr in s_matnr
                                          and makt~spras in s_spras.
      check sy-subrc = 0.
    Regards,
    Rich Heilman

  • ALV - how to make selectable only some rows on an ALV?

    Hi my problem is:
    I have an ALV GRID as output of a report.
    I have to make selectable only few rows based on the contents of a field (showed in a column in the ALV).
    Is it possible?
    Best Regards, Vincenzo

    I did understand, but as i told you there is nothing like that, neither an option nor an event to capture.
    Here is the documentation: http://help.sap.com/saphelp_erp2005vp/helpdata/EN/bf/3bd1369f2d280ee10000009b38f889/frameset.htm
    Read it and choose what you need and what is in existance.

  • How to make select as variable for Export-csv?

    Hello, 
    I'm trying to get the script to work which can iterate over topics and make predefined selection based on current active topic on iteration. It seems that the problem is simple, but I can't find the solution.
     The source file is the following:
    topic=interface_bridge ruleaction=add name=vlan10
    topic=interface_bridge ruleaction=add name=vlan13
    topic=interface_bridge ruleaction=add name=vlan14
    topic=interface_bridge ruleaction=add name=vlan20
    topic=interface_ethernet set=0 comment=DMZ
    topic=interface_ethernet set=1 comment=DMZ
    topic=interface_ethernet set=2 comment=Servers
    topic=interface_ethernet set=4 comment=WKS
    topic=interface_ethernet set=5 comment=VMWARE
    topic=interface_ethernet set=6 comment=WKS
    topic=interface_ethernet set=10 comment=External
    The current script is the following:
    $file="c:\scripts\mk.txt"
    #selections
    $interface_ethernet='comment','name','set','switch','master-port'
    $interface_bridge='comment','name','protocol-mode'
    #topics
    $topics1=@($interface_ethernet, $interface_bridge)
    $topic_int_bridge='interface_bridge'
    $topic_int_ethernet='interface_ethernet'
    $topics=@($topic_Int_bridge, $topic_int_ethernet)
    foreach ($topic in $topics)
    $match='^topic='+$topic+'\s+'
    $result_File = 'config_'+$topic+'.txt'
    $select = '$'+$topic
    $interface_ethernet='comment','name','set','switch','master-port'
    $interface_bridge='comment','name','protocol-mode'
    $topics1=@($interface_ethernet,$interface_bridge)
    $select1=invoke-expression ('$'+$topic)
    $results = Get-Content mk.txt | Where-Object { $_ -Match $match }| foreach { new-object PSObject -Property $($_ -replace '^' -replace ' ',"`n" | convertfrom-stringdata) }
    $results | select $select1
    I'm hang on the following: when I run the script it only takes first selection ($interface_bridge) gives the result about first topic (bridge), and for second (ethernet) - only comments.
    comment name protocol-mode
    vlan10
    vlan13
    vlan14
    vlan20
    DMZ
    DMZ
    Servers
    WKS
    VMWARE
    WKS
    External
    There can be many topics, so write If expression for each it's not the case.
    Question:
    How to modify the script that the result is printed for each topic with adequate section:
    1) when looping over topics, when the topic interface_ethernet is processed select and print results for variable $interface_ethernet
    (selected items 'comment','name','set','switch','master-port')
    2) when looping over topics, when the topic interface_bridge is processed select and print results for variable $interface_bridge
    (selected items 'comment','name','protocol-mode')
    3) etc...
    Each topic should be on separated iteration block because for each will be generated csv file with each own header. 
    Thanks.

    Hello!
    I'm trying to understand why the script does not work. The question is:
    Is it correct way of using the "invoke-epression" on code?
    $select1=invoke-expression ('$'+$topic)

  • How to make select statement wait

    how can i make the select statement wait until there is not lock on the table( or a row) and return the row once the lock is released is there is a lock on it
    example
    i have a Table t1 with columns c1 and c2
    process1
    stmt1 as select c1 from t1 where c1=1
    process2
    select c1 from t1 where c1=1
    /*some operations */
    update t1 set c2=4 where c1=1
    when process1 is executed it has to wait for process 2 to complete the return a row since it has to be synchronised and are run from different location
    thanks in advance

    You want to get around session consistent select. This is such a nice feature actually. But if you really want to do it, you can fool process 1 by telling it you want to do an update.
    This is process 2:
    SQL> update emp set sal=900 where empno=7369;
    1 row updated.Note I do not commit yet.
    This is process 1, with a "select for update".
    SQL> select sal from emp where  empno=7369 for update wait 10;
    select sal from emp where  empno=7369 for update wait 10
    ERROR at line 1:
    ORA-30006: resource busy; acquire with WAIT timeout expired"wait 10" tells Oracle to wait 10 seconds to get a lock.
    Now process 2 commits within the 10 seconds. The result of process 1 is then:
    SQL> select sal from emp where  empno=7369 for update wait 10;
           SAL
           900
    SQL> commit;You have to issue a commit or rollback in process 1 immediately to release the lock that process 1 laid on the record.

  • How to make Select List Read only (Keep key Data)

    I'd like to make a select list read only when the screen is in maintenance mode because the select list value is part of the key.
    However, when I make the select list read only, the update fails because it appears making it disable lose's it's value.
    How can I make a select list read only and keep it's value for update.

    In HTML Header I have
    <script type="text/javascript">
    function Disable_List(pthis,hideitem)
    if ($x(hideitem).value == 'Y')
    {   $x(pthis).disabled = "disabled";
    </script>
    <script type="text/javascript">
    function Load_Start()
    Disable_Item('P5_SUBCODE','P5_XW_HAS_VALUE');
    Disable_List('P5_LTY','P5_XW_HAS_VALUE');
    </script>
    When I click apply changes, my Validation check that doesn't allow nulls in the "P5_LTY" fires saying the field can't be null. The select list is grayed out and I see the value, but the validation check thinks it's null.
    Edited by: spuchc on Jun 15, 2010 8:03 AM

  • How to make selections in Photoshop CS2???

    Hello, I ran into a little issue doing this tutorial http://www.webdesign.org/web/photoshop/web-layout/dark-style-web-template.16864.html
    In this tutorial it tells you in 2 different sections to make a selection i'm guessing with the marquee tool. The first is in the header section (which looks sorta triangular) and the second is the menu bar which they ask you to select the top half. In both request they tell you to fill in with white and then turn the opacity to 5%. Now to my knowledge when you use the marquee tool I have no clu how they made the marquee tool "hug" the graphic the way it does in the images in the tutorial. even in the second one it seems to cut the rounded rectangle in half but the marquee hugs the curves of the top half of the rounded rectangle. Plus when I do use the marquee tool and try to "fill" it won't let me. I had to use the rectangle marquee tool and "layer via copy" to cut the image in half then fill that in white and reduce the opacity to 5%. I seem to get the same result but I definetely feel that there's something i'm missing. In my Total Training dvd's I remember learning to use the left and right arrow key to tighten the marquee to an object but I believe that is in FireWorks. Is there some shortcut to do it in PS? Please Help!........ Very frustrated but very dedicated to learning web design.

    for the first selection Ctrl+Click on the Vector Mask thumbnail to load it as a selection and then select the Polygonal Lasso Tool and set Subtract from Selection in the Options Bar and cut the first selection to get that. Same thing for the second one
    http://help.adobe.com/en_US/Photoshop/11.0/WSfd1234e1c4b69f30ea53e41001031ab64-76faa.html

  • Procurement Type - How to make selectable field

    In standard SAP system, for material type ROH procurement type is defaulted (greyed out)
    to "F", how to change to selectable field {to X/E}
    Thanks

    Hi
    I am not sure about the Business requirement why you need to change the Procurement type for ROH from Standard F.There is one more option to make the Procurement type field active in MRP-2 view by doing the cust setting in the material type. 
    IMG Path > Logistics - General > Material Master > Basic Settings > Material Types > Define Attributes of Material Types
    Choose Material Type > ROH and Click on Details
    In the next screen under Internal/External Purchase orders selection change the setting to Int. purchase orders as 1 from 0 and SAVE
    Now create the material with ROH using MM01 > In the MRP-2 view the Procurement type field become active with Default value as X. Here we can change the P/ type as F manually
    Regards
    Brahmaji

  • How to make selective fields of VD03 editable?

    Hi all,
    In VD03 transaction, if i press the Display -> Change option in Customer menu all the fields of the tabstrip sales, Billing Documents and Partner functions gets enabled, i.e ready for change. But I need to make only certain fields editable and the remaining fields need to be grayed out. How to achieve it?
    Thanks in Advance,
    Aravindan.

    hi,
    For this you can use screen Variant(Using Transaction SHD0) and assign this screen variant to all user
    Regards,
    Alpesh

  • SQL Server - How to make SELECT block with TRANSACTION_SERIALIZABLE

    I'm in the process of switching an application to use SQL Server. Is there anyway of making a SELECT in SQL Server implement a lock (and therefore also get blocked) similar to an INSERT or UPDATE?
    Essentially, I have code that tracks a transaction ID for a particular customer; given there can be concurrent access from the same customer, I am using TRANSACTION_SERIALIZABLE:
    long id = 0L; // Customer ID stmt = Conn.prepareStatement("SELECT TxID FROM TxIDTable WHERE (ID = ?)"); stmt.setLong(1, id); result = stmt.executeQuery(); result.next(); int tx_id = result.getInt("TxID"); result.close(); stmt.close(); stmt = Conn.prepareStatement("UPDATE TxID SET TxID = ? WHERE (ID = ?)"); stmt.setInt(1, tx_id + 1); stmt.setLong(2, id); stmt.executeUpdate(); stmt.close(); Conn.commit();
    This code is working, however on SQL Server I have to wrap a loop around it, and if I catch a deadlock exception, rerun the transaction. This is costly and I would much rather have the SELECT create a lock and therefore block any concurrent SELECTs. One workaround is to force a dummy UPDATE up front:
    long id = 0L; // Customer ID stmt = Conn.prepareStatement("UPDATE TxIDTable SET ID = ? WHERE (ID = ?)"); stmt.setLong(1, id); // THIS UPDATE DOES NOT REALLY UPDATE ANYTHING stmt.setLong(2, id); // (NOTE SET AND WHERE CLAUSE ARE IDENTICAL) stmt.executeUpdate(); // HOWEVER, IT DOES EFFECTLY PREVENT DEADLOCK // BY CREATING A TABLE LOCK BEFORE THE SELECT stmt.close(); // stmt = Conn.prepareStatement("SELECT TxID FROM TxIDTable WHERE (ID = ?)"); stmt.setLong(1, id); result = stmt.executeQuery(); result.next(); int tx_id = result.getInt("TxID"); result.close(); stmt.close(); stmt = Conn.prepareStatement("UPDATE TxIDTable SET TxID = ? WHERE (ID = ?)"); stmt.setInt(1, tx_id + 1); stmt.setLong(2, id); stmt.executeUpdate(); stmt.close(); Conn.commit();
    This seems really like a waste -- anyway to make the SELECT lock on SQL Server??
    Thanks,
    Kevin

    You want a table hint (the equivalent of SELECT ... FOR UPDATE in other dialects):
    [http://msdn2.microsoft.com/en-us/library/ms187373.aspx|http://msdn2.microsoft.com/en-us/library/ms187373.aspx]

  • How to make select option in module pool

    Hello,
    Can anybody tell me how to create a select option in module pool screen..?
    thanks

    Easiest way is to create a subscreen and embed this in your dynpro.
    report zrich_0006 .
    tables: mara.
    * Custom Selection Screen 1010
    selection-screen begin of screen 1010 as subscreen.
    selection-screen begin of block b1 with frame title text-001.
    parameters: p_rad1 radiobutton group grp1 default 'X',
                p_rad2 radiobutton group grp1,
                p_rad3 radiobutton group grp1.
    select-options: s_matnr for  mara-matnr,
                    s_matkl for  mara-matkl,
                    s_mtart for  mara-mtart.
    selection-screen end of block b1.
    selection-screen end of screen 1010.
    start-of-selection.
      call screen 100.
    *&      Module  STATUS_0100  OUTPUT
    module status_0100 output.
    *  SET PF-STATUS 'xxxxxxxx'.
    *  SET TITLEBAR 'xxx'.
    endmodule.
    *&      Module  USER_COMMAND_0100  INPUT
    module user_command_0100 input.
    endmodule.
    * Screen screen 100 with a subscreen area called "subscreen_1010"
    * Screen Flow Logic follows
    *process before output.
    *  module status_0100.
    *  call subscreen subscreen_1010 including sy-repid '1010'.
    *process after input.
    *  call subscreen subscreen_1010 .
    *  module user_command_0100.
    Regards,
    Rich Heilman

  • How to make selection on JComboBox.

    Dear all,
    I want to make condition on basis of selection of JComboBox. Any one have code of such scenrio.
    Thanks in advance.

    Any one have code of such scenrio.Sun does.
    {color:#0000ff}http://java.sun.com/javase/6/docs/api/javax/swing/JComboBox.html#getSelectedIndex()
    http://java.sun.com/javase/6/docs/api/javax/swing/JComboBox.html#getSelectedItem()
    http://java.sun.com/docs/books/tutorial/uiswing/components/combobox.html
    {color}
    db

Maybe you are looking for

  • IT WONT LET ME DOWNLOAD WINDOWS 8.1

    I have tried many times to update my laptop to windows 8.1 but it says 'this application wasn't installed -view details '.I click on that and it repeatably says it couldn't be installed and offers to try again .The error code "0x8020002e' keeps comin

  • Grayout of  component screen  fields in ME21N transaction

    Hi experts,    I have a problem while creating subcontracting PO i want to gray out the fields of component screen...in ME21N transaction...is it possible through the screen varient or else should i go for exit  ??...could u please help me in finding

  • How to view the content of Documents attached in Transaction FB03.

    Hi Gurus, I want to view / download the content of an attachment, attached in transaction FB03. I am not able to view them directly due to some application error. I need to check whether a document which is in the attachment list is having any data o

  • Cleaning my iMac screen...

    My iMac screen gets very dirty very quickly. What can I use to clean it?

  • System priv ??

    Hi, In our application we are creating oracle user thr forms using FORMS_DDL but we are not able to grant priviledges thr Forms. our appl reqt thr application is to create user & grant connect, resource and one more role to this user how can we do th