Resultset Eventing

Hi all,
Could you please help me on the below scenario
I have a webdynpro application, which takes the Partner Number as input and gets the record ID from MDM. Now with the record ID i want to display that records in a standard Resultset iview.
How can this be achieved
Thanks
Suresh

Hi Suresh,
From the MDM Portal Content Development Guide, "Configuring Events on a Result Set iView":
You can configure EPCF and URL events using the Result Set iView Event Builder to accept requests from a Web Dynpro application.
Typically the MDM custom event listeners used for limiting a Result Set from the
custom application would be:
- getRecordByIds (EPCF) and GetRecordByIds (URL)
- updateSearch (EPCF) and SetSearchHandler (URL)
More details can be found in the guide.
hope this information helps,
Idan

Similar Messages

  • MDM iView resultset problem and question about eventing

    Hi experts,
    I created a MDM iView resultset for my main table as search table (comparison is not supported). When I click on preview I get an empty table ("Found <Tablename>: 0 of 10", table contains 10 entries at the moment). I tried the same with a subtable and everything works fine (all entries have been in the preview table). Any ideas why I don't get a result?
    My 2nd question: can I choose the parameter name in eventing (EPCF) on my own? So if I have Vendor_Id as field can I use vendorid as parameter name? Do I have to define anything in the listener iView (e.g. in detail iView for an event from resultset iView)? Maybe you have a useful tutorial link (please not SAP help section)?
    Thanks for your answers.
    Regards, bd

    It is possible to retrieve the number of rows from a resultset --
    Statement stmt= con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
                                        ResultSet.CONCUR_READONLY);
    ResultSet rs= stmt.executeQuery("<your select query here>");
    int totalRows;
    if (rs.last()) // can it move to the last row?
       totalRows= rs.getRow(); // get its row number
    else
       totalRows= 0; // no rows in the resultset
    rs.first() // set the cursor back to the startNote that the resultset has to be scrollable (TYPE_SCROLL_INSENSITIVE).
    kind regards,
    Jos

  • ResultSet IView - eventing - hand over serveral records

    Hi experts,
    we use a standard resultset iview for connecting the repository with the EP - this works fine.
    In case of "eventing": is there a possiblity to hand over more than one record via EPCF-eventing to another IView on the same page?
    The target is an Visual Composer IView.
    I would be glad, if there is an quick and easy possibility.
    Thank you in advance for your answers.
    Karin

    Hi
    I am trying to Export the data from Result Set Iview to Excel using a Java Web dynpro application.
    I am passing an MDM search parameter but when I am trying to get the value ,its coming as null...
    This is what I am doing
    public void wdDoInit()
        //@@begin wdDoInit()
         wdThis.readSystemDtls();
         namespace = "urn:com.sap.tc.webdynpro.exporttocsv";
         eventname= "Export";
         WDPortalEventing.subscribe(namespace,eventname,wdThis.wdGetExportAction());
        //@@end
    public void onActionExport(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, java.lang.String value )
        //@@begin onActionExport(ServerEvent)
        wdComponentAPI.getMessageManager().reportSuccess("data"+value);
         int marked=value.indexOf("=");
         String srcValue=value.substring(marked+1);\wdContext.currentContextElement().setCatchedValue(srcValue);
         String targetValue=wdContext.currentContextElement().getCatchedValue();
         Search search = Search.deserialize(targetValue);
    Can you please help...

  • Resultset Update in a Event !

    First i do the connect with mysql 4.1.11 and mysqlconnector 5.15..
    url = "jdbc:mysql://" + server + "/dbname?user=user&password=pass";                         Class.forName("org.gjt.mm.mysql.Driver").newInstance();             connect = DriverManager.getConnection(url);                                     System.out.println(url);                             System.out.println("Connection successful");
    then the i do a normal query
                query = "SELECT * FROM betriebe where ergebnis is null and " +                 "((wieder_am is not null and wieder_am<now() and mitarbeiter=" + mitarbeiter  +") or "+                 "(mitarbeiter is null and wieder_am is null)) ORDER BY wieder_am desc, last_call limit 1;";             rS = state.executeQuery(query);             rS.updateString("ID_NUMMER","blub");  // this is working at this point !!!!             rS.updateInt("mitarbeiter",mitarbeiter);    // this is working at this point !!!!             rS.updateRow();                                    // this is working at this point !!!
    Now my problem. I got a button on my GUI which has a Listener with this method
    void cmd_nichterledigt_actionPerformed(ActionEvent e)     {         ResultSet tmp;         try         {             SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss");             java.util.Date currentTime_1 = new java.util.Date();             String dateString = formatter.format(currentTime_1);             System.out.println(dateString);             rS.updateString("Memo", txt_memo.getText()); // Here the error happens !                         rS.updateNull("ergebnis");             rS.updateNull("wieder_am");             rS.updateNull("mitarbeiter");             rS.updateInt("Wiedervorlage",0);             rS.updateRow();           } } Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at com.mysql.jdbc.ResultSetImpl.findColumn(ResultSetImpl.java:1059) at com.mysql.jdbc.UpdatableResultSet.updateString(UpdatableResultSet.java:2487) at aokframe.modify(aokframe.java:995) at aokframe.cmd_nichterledigt_actionPerformed(aokframe.java:1889) at aokframe$1.actionPerformed(aokframe.java:421)
    idk what i am doing wrong. My resultset must be closed somehow. But i coundn´t found my mistake. thx for any help.

    Hi,
    You really shouldn't be mixing GUI and JDBC code.
    I am guessing you have closed or re-executed the statement which generated the resultset.
    I suggest reading about the Data Access Object (DAO) design pattern to limit the scope of your resultset objects and to separate JDBC code from the rest of your application.
    Good luck!

  • Exporting Result from resultset iview through EPCF eventing

    Hi
    I am trying to Export the data from Result Set Iview to Excel using a Java Web dynpro application.
    I am passing an MDM search parameter but when I am trying to get the value ,its coming as null...
    This is what I am doing:
    public void wdDoInit()
    //@@begin wdDoInit()
    wdThis.readSystemDtls();
    namespace = "urn:com.sap.tc.webdynpro.exporttocsv";
    eventname= "Export";
    WDPortalEventing.subscribe(namespace,eventname,wdThis.wdGetExportAction());
    //@@end
    public void onActionExport(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, java.lang.String value )
    //@@begin onActionExport(ServerEvent)
    wdComponentAPI.getMessageManager().reportSuccess("data"+value);
    int marked=value.indexOf("=");
    String srcValue=value.substring(marked+1);\wdContext.currentContextElement().setCatchedValue(srcValue);
    String targetValue=wdContext.currentContextElement().getCatchedValue();
    Search search = Search.deserialize(targetValue);
    Please help...

    Hi,
    Refer the below link which explains the step by step procedure for the requirement you are looking for
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/504814b6-da5f-2b10-0dbd-e5ee597c74a5
    Regards,
    Jitesh Talreja

  • Mysterious closing ResultSets

    I'm getting desperate for a solution to this problem (as is the rest of the development team!).
    Basically we've been trying to create a system that automatically assigns values (frequencies) to objects (nodes) based on a rule set. Each node contains a varying number of sub-objects (radios) and each radio needs one frequency. The database has been set up and has test data for our Solution class to go through. However, we've run into an odd problem where our ResultSets are suddenly closing.
    The classes work like this:
    Database Broker (handles connection to DB, as well as executeQuery and executeUpdate statements.)
    Entry Broker (Holds all SQL statements for data retrieval in various methods. Each method contains an SQL statement to access data, and code to format that data into something useable by the main class.
    Solution/Main class (Contains methods to use the data from the Entry Broker to test valid solutions. Certain rules apply to assigning frequencies to radios and this class ensures that the data applies to these rules before it writes the data back to the DB (via the EntryBroker).
    The problem we continually run into is that whilst the ResultSets work fine in the Entry Broker, they are closed when they return to the Main class.
    Here's the catch: It seems in most cases that only the FIRST ResultSet returned in each method is closed, the remaining ResultSets work fine. We worked around this problem by creating a 'dummy' ResultSet, which obtained data from the database which was never used (the project name). We put this in its own try catch bracket so it would not interrupt the project.
    It worked fine for a few classes, but for others (notably the following one) it was ineffective. We've searched and searched but we cannot find anyone with a similar complaint (except a few people who have commented about ODBC version problems). Our ODBC version is 3.520.7713.0
    Here's an example method from the Solution class (The entire class is over 1000 lines):
    // Method to test Harmonic resonance for nodes within 10m
    private boolean resonanceGlobal (boolean tstResonanceG, double txFreq, double rxFreq, int distance)     {
    System.out.println("Beginning global harmonic resonance check");
    try {
    // Getting Nodes
    rsNode2 = eBroker.getNodes(projectNo);
    // node loop
    while (rsNode2.next())     {
    System.out.println("602 Test Marker GHarm 1");
    // get next node, store in nodeTemp
    nodeTemp = rsNode2.getInt(1);
    // System out to show which nodes will pass if statement
    System.out.println(node + " compare to " + nodeTemp);
    // avoid testing the same node against itself
    if (nodeTemp != node)     {
    // distance check (only neccesary within 10m)
    System.out.println("Test Marker Before Distance check");
    distance = getDistance(node, nodeTemp, distance);
    System.out.println("Test Marker After Distance check");
    // distance check if statement
    if (distance <= 10)     {
    System.out.println("618 Test Marker GHarm 2");
    // get the radios of the node, foreign node
    rsRadiosTemp = eBroker.getRadios(node);
    rsDummy = eBroker.getDummy(projectNo);
    rsRadios2 = eBroker.getRadios(nodeTemp);
    // This dummy ResultSet normally fails so that
    // the other ResultSets perform normally
    try {
    rsDummy.next();
    }     // end try
    catch (java.sql.SQLException dummyException)     {
    System.out.println("dummyException " + dummyException);
    }     // end catch
    // radio loop
    while (rsRadiosTemp.next())     {     // error occurs here
    System.out.println("627 Test Marker GHarm 3");
    // loop for foreign node radios
    while (rsRadios2.next())     {
    System.out.println("631 Test Marker GHarm 4");
    // get next radio
    radioTemp = rsRadios2.getInt(1);
    // get the TX and RX of the radio
    genericTX = getTX(radioTemp);
    radioTempCon = getConnection(radioTemp);
    genericRX = getTX(radioTempCon);
    // calculate bounds for harmonics test
    txLo = ((txFreq * 2) - genericTX) - 4;     // 4Mhz below TX harmonics check
    txHi = ((txFreq * 2) - genericTX) + 4;     // 4Mhz above TX harmonics check
    rxHi = ((rxFreq * 2) - genericRX) + 4;     // 4Mhz above RX harmonics check
    rxLo = ((rxFreq * 2) - genericRX) - 4;     // 4Mhz below RX harmonics check
    // checks TX and RX of foreign radio against TX, RX of current radio for separation
    if ((txLo > genericTX && txHi < genericTX) || (rxLo > genericRX && rxHi < genericRX))     {
    tstResonanceG = false;     
    break;
    } //end if
    else {
    tstResonanceG = true;
    }     // end else
    } //end foreign radio loop
    // breaking out of loops for return
    if (tstResonanceG == false)
    break;
    }     // end radio loop
    rsRadios2.close();
    rsRadiosTemp.close();
    }     // end sameradio check
    }     // end distance check
    }// end node loop
    rsNode2.close();
    }     // end try
    // Catch statement to stop from crashing in the
    // event of an error during SQL statements.
    catch (java.sql.SQLException resonanceGlobalException) {
    // Prints out the error message produced
    System.out.println(resonanceGlobalException);
    }     // end catch
    // returns result
    return tstResonanceG;
    } //end checkHarmonicResonanceGlobal()
    My apologies if it is a little hard to read, but the indenting is accurate. The Entry Broker methods which this method uses are here:
    public ResultSet getNodes (int projectNo) {
    // creating SQL statement
    sqlStatement = "SELECT nodeNo from tblNode WHERE projectNo = " + projectNo;
    System.out.println(sqlStatement);
    // executing SQL statement
    rsNodes = db.runQuery(sqlStatement);
    // returns ResultSet
    return rsNodes;
    }     // end getNodes
    // Method to get the distance between any two nodes
    public int getDistance (int projectNo, int node, int tempNode)     {
    ResultSet rsX1;                         // Used for obtaining the X-coord of node 1
    ResultSet rsX2;                         // Used for obtaining the X-coord of node 2
    ResultSet rsY1;                         // Used for obtaining the Y-coord of node 1
    ResultSet rsY2;                         // Used for obtaining the Y-coord of node 2
    double distance = 0;                    // Used in Global checks
    int dist = 0;                              // Used in Global checks
    int x1 = 0;                                   // Used in calculating distance
    int x2 = 0;                                   // Used in calculating distance
    int y1 = 0;                                   // Used in calculating distance
    int y2 = 0;                                   // Used in calculating distance
    int xDist = 0;                              // Used in calculating distance
    int yDist = 0;                              // Used in calculating distance
    int distint = 0;                         // Used to store converted values
    try {
    // get the X and Y co-ordinates of both nodes
    sqlStatement = "SELECT xCoord FROM tblNode WHERE nodeNo = " + node + " AND projectNo = " + projectNo;
    rsX1 = db.runQuery(sqlStatement);
    rsX1.next();
    x1 = rsX1.getInt(1);
    sqlStatement = "SELECT yCoord FROM tblNode WHERE nodeNo = " + node + " AND projectNo = " + projectNo;
    rsY1 = db.runQuery(sqlStatement);
    rsY1.next();
    y1 = rsY1.getInt(1);
    sqlStatement = "SELECT xCoord FROM tblNode WHERE nodeNo = " + tempNode + " AND projectNo = " + projectNo;
    rsX2 = db.runQuery(sqlStatement);
    rsX2.next();
    x2 = rsX2.getInt(1);
    sqlStatement = "SELECT yCoord FROM tblNode WHERE nodeNo = " + tempNode + " AND projectNo = " + projectNo;
    rsY2 = db.runQuery(sqlStatement);
    rsY2.next();
    y2 = rsY2.getInt(1);
    }     // end try
    catch (java.sql.SQLException getDistanceException) {
    System.out.println(getDistanceException);
    // calculating distance
    yDist = y2 - y1;
    xDist = x2 - x1;
    // perform pythagoras theorem for distance
    dist = (xDist * xDist) + (yDist * yDist);
    distance = java.lang.Math.sqrt(dist);
    Double roundFreqTemp = new Double(freqTemp);
    distint = roundFreqTemp.intValue() ;
    return distint;
    } // end get distance method
    // Method to get all the radios in a node
    public ResultSet getRadios(int node)     {
    ResultSet rsRadios;          // Used for obtaining radios in a node
    // creating sql Statement
    sqlStatement = "SELECT * FROM tblRadio WHERE nodeNo =" + node;
    System.out.println(sqlStatement);
    // executing sql Statement
    rsRadios = db.runQuery(sqlStatement);
    System.out.println("EB Test Marker 1: Line 261");
    // returning radio no
    return rsRadios;
    }//end getRadio
    public double getTX(int radioTemp){
    double txTemp = 0;     // Used for storing TX of a radio
    int freqNoTemp = 0; // Used for storing the frequency ID
    rsDummy = getDummy(projectNo);
    // creating SQL statement
    sqlStatement ="Select frequencyNo from tblRadio where radioNo = " + radioTemp;
    System.out.println(sqlStatement);
    // executing SQL statement
    rsTX = db.runQuery(sqlStatement);
    try {
    System.out.println("Test Marker EB1: 317");
    try {
    rsDummy.next();
    }     // end try
    catch     (java.sql.SQLException dummyException)     {
    System.out.println("dummyException" + dummyException);
    }     // end catch
    System.out.println("Test MarkerEB2: 330");
    // moving to first position in rs
    rsTX.next();
    System.out.println("Test MarkerEB3: 334");
    // obtaining data from rs
    freqNoTemp = rsTX.getInt(1);
    System.out.println("Test MarkerEB4: 337");
    rsTX.close();
    }     // end try
    catch (java.sql.SQLException rsTXException)     {
    System.out.println("rsTXExeption: " + rsTXException);
    }     // emd catch
    System.out.println("Frequency No is: " + freqNoTemp);
    rsDummy = getDummy(projectNo);
    sqlStatement = "Select frequency from tblFreq where frequencyNo = " + freqNoTemp;
    System.out.println(sqlStatement);
    rsRX = db.runQuery(sqlStatement);
    try {
    try {
    System.out.println("Test MarkerEB6: 361");
    rsDummy.next();
    }     // end try
    catch     (java.sql.SQLException dummyException)     {
    System.out.println("dummyException" + dummyException);
    }     // end catch
    System.out.println("Test MarkerEB5: 373");
    rsRX.next();
    System.out.println("Test MarkerEB7: 376");
    txTemp = rsRX.getDouble(1);
    System.out.println("Test MarkerEB8: 379");
    rsRX.close();
    }     // end try
    catch (java.sql.SQLException rxException) {
    System.out.println("rxException " + rxException);
    } // end catch
         System.out.println("393 Before return");
    return txTemp;
    }     //end getTX
    public int getConnection(int radio) {
    int nodeCon = 0;                    // Used to return the connected node no
    ResultSet rsConnection;          // Used for obtaining the foreign radio
    // creating SQL statement
    sqlStatement = "SELECT radioNo FROM tblRadio where recRadio = " + radio;
    System.out.println(sqlStatement);
    // executing SQL statement
    rsConnection = db.runQuery(sqlStatement);
    try {
    // moving to first position in rs
    rsConnection.next();
    // obtaining data from rs
    nodeCon = rsConnection.getInt(1);
    }     // end try
    catch (java.sql.SQLException getConnectionException) {
    System.out.println("getConnectionException : " + getConnectionException);
    }     // end catch
    // returns node no.
    return nodeCon;
    And finally, the dummy rs:
    // Dummy method to fix resultSet closed error
    public ResultSet getDummy (int projectNo) {
    sqlStatement = "Select projectName from tblProject where projectNo = " + projectNo;
    System.out.println(sqlStatement);
    rsDummy = db.runQuery(sqlStatement);
    return rsDummy;
    Here is some sample output that we have:
    ----jGRASP exec: java MainGui
    slider value constructor: 50
    116: if(singleton==null) {
    120: singleton=new Resolvotron
    Connection to D/Base establised
    Select projectName from tblProject where projectNo = 3
    Init OK. Beginning solve process
    main OK: beginning frequency assign process
    SELECT nodeNo from tblNode WHERE projectNo = 3
    267: Node number = 2
    SELECT * FROM tblRadio WHERE nodeNo =2
    EB Test Marker 1: Line 261
    Test Marker 1: Line 289
    298: Radio number = 4
    Test Marker 5: Line 308
    Test Marker 3: Line 313
    SELECT frequency from tblFreq WHERE projectNo = 3
    125.5
    Beginning test process
    Test Marker 4: Line 386
    Beginning check 257072
    Test Marker 6: Line 774
    70 Mhz Margin = false
    Beginning local 10Mhz separation check
    SELECT * FROM tblRadio WHERE nodeNo =2
    EB Test Marker 1: Line 261
    Getting TX of radio: 4
    Select projectName from tblProject where projectNo = 3
    Select frequencyNo from tblRadio where radioNo = 4
    Test Marker EB1: 317
    dummyExceptionjava.sql.SQLException: ResultSet is closed
    Test MarkerEB2: 330
    Test MarkerEB3: 334
    Test MarkerEB4: 337
    Frequency No is: 2
    Select projectName from tblProject where projectNo = 3
    Select frequency from tblFreq where frequencyNo = 2
    Test MarkerEB6: 361
    dummyExceptionjava.sql.SQLException: ResultSet is closed
    Test MarkerEB5: 373
    Test MarkerEB7: 376
    Test MarkerEB8: 379
    393 Before return
    432: getting connection
    SELECT radioNo FROM tblRadio where recRadio = 4
    438: getting TX of radio: 6
    Select projectName from tblProject where projectNo = 3
    Select frequencyNo from tblRadio where radioNo = 6
    Test Marker EB1: 317
    dummyExceptionjava.sql.SQLException: ResultSet is closed
    Test MarkerEB2: 330
    Test MarkerEB3: 334
    Test MarkerEB4: 337
    Frequency No is: 2
    Select projectName from tblProject where projectNo = 3
    Select frequency from tblFreq where frequencyNo = 2
    Test MarkerEB6: 361
    dummyExceptionjava.sql.SQLException: ResultSet is closed
    Test MarkerEB5: 373
    Test MarkerEB7: 376
    Test MarkerEB8: 379
    393 Before return
    java.sql.SQLException: ResultSet is closed
    10 Mhz Local = true
    Beginning 10 Mhz separation check
    SELECT nodeNo from tblNode WHERE projectNo = 3
    Node number is 2
    10 Mhz Global = false
    Beginning local harmonic resonance check
    SELECT * FROM tblRadio WHERE nodeNo =2
    EB Test Marker 1: Line 261
    Select projectName from tblProject where projectNo = 3
    Select frequencyNo from tblRadio where radioNo = 4
    Test Marker EB1: 317
    dummyExceptionjava.sql.SQLException: ResultSet is closed
    Test MarkerEB2: 330
    Test MarkerEB3: 334
    Test MarkerEB4: 337
    Frequency No is: 2
    Select projectName from tblProject where projectNo = 3
    Select frequency from tblFreq where frequencyNo = 2
    Test MarkerEB6: 361
    dummyExceptionjava.sql.SQLException: ResultSet is closed
    Test MarkerEB5: 373
    Test MarkerEB7: 376
    Test MarkerEB8: 379
    393 Before return
    SELECT radioNo FROM tblRadio where recRadio = 4
    Select projectName from tblProject where projectNo = 3
    Select frequencyNo from tblRadio where radioNo = 6
    Test Marker EB1: 317
    dummyExceptionjava.sql.SQLException: ResultSet is closed
    Test MarkerEB2: 330
    Test MarkerEB3: 334
    Test MarkerEB4: 337
    Frequency No is: 2
    Select projectName from tblProject where projectNo = 3
    Select frequency from tblFreq where frequencyNo = 2
    Test MarkerEB6: 361
    I'll leave it at that, since the program goes into an endless loop. The dummy Exceptions are our dummy resultsets crashing so the rest can survive. The other stuff is from different methods. You should be able to locate the logic of the program by following the System.outs
    Test Markers with EB refer to the Entry Broker.
    Any help would be appreciated since we cannot find any other way of running this class successfully.
    Steve

    Ok problem solved...
    Basically I was calling one ResultSet after another. Thanks to the Database Broker's structure, this was killing the first ResultSet. I fixed up the loops so that ResultSets were only ever called just before they were needed, and it fixed the problem. The only other errors were simple logic faults which I drummed out in short order. Thanks for the help everyone!

  • How to trap Submit button event in OAF

    Hello,
    I'm doing controller extension for create account button in Customer UI.
    Issue: I'm not able to trap the table action to add extra validation logic.
    I tried to use pageContext.getParameters("CreateButton") but it didn't work i.e. debug message was not printed written inside if statement.
    Button Structure:
    TableAction
    Flowlayout
    Submit button.
    Code:
    public void processFormRequest(OAPageContext pageContext,
                                       OAWebBean webBean) {
            //super.processFormRequest(pageContext, webBean);
            OAApplicationModule am = pageContext.getApplicationModule(webBean);
            ArrayList exceptions = new ArrayList();
            OAFlowLayoutBean oaflowlaybean =
                (OAFlowLayoutBean)webBean.findChildRecursive("TableActionsRN");
            OASubmitButtonBean vbuttonBean =
                (OASubmitButtonBean)oaflowlaybean.findChildRecursive("CreateButton");
            String buttonId = vbuttonBean.getID();
            String buttonId12 = vbuttonBean.getName();
            String asd=vbuttonBean.getEvent();
            String s = pageContext.getParameter(EVENT_PARAM);
            String s1 = pageContext.getParameter(vbuttonBean.getName());
                if (s.equalsIgnoreCase("CreateAccount")) {
                OAViewObject vo =
                    (OAViewObject)am.findViewObject("HzPuiAccountTableVO");
                if (vo != null) {
                    pageContext.writeDiagnostics("Jai-1", "VO Found", 1);
                    OARow row = (OARow)vo.getCurrentRow();
                    if (row != null) {
                        pageContext.writeDiagnostics("Jai-2", "Row Found", 1);
                        String partyid =
                            (String)row.getAttribute("PartyId").toString();
                        pageContext.writeDiagnostics("Jai-3", "PartyId" + partyid,
                                                     1);
                        int PartyNum = Integer.parseInt(partyid);
                        String partyacctcnt = null;
                        try {
                            OracleConnection conn =
                                (OracleConnection)pageContext.getApplicationModule(webBean).getOADBTransaction().getJdbcConnection();
                            pageContext.writeDiagnostics("Jai-4", "Inside Try", 1);
                            String query =
                                "SELECT count(1) lcount  FROM HZ_CUST_ACCOUNTS WHERE party_id=:1";
                            PreparedStatement stmt = conn.prepareStatement(query);
                            stmt.setInt(1, PartyNum);
                            ResultSet resultset = (ResultSet)stmt.executeQuery();
                            if (resultset.next()) {
                                pageContext.writeDiagnostics("Jai-5",
                                                             "Inside Result Next",
                                                             1);
                                partyacctcnt = resultset.getString("lcount");
                            stmt.close();
                        } catch (SQLException sqlexception) {
                            throw OAException.wrapperException(sqlexception);
                        int i = Integer.parseInt(partyacctcnt);
                        /*   String HoldFlag = (String)row.getAttribute("Attribute11");
                        // Check Hold Flag: "Y" then restrict to create new account
                        if (HoldFlag == "Y") {
                            pageContext.writeDiagnostics("Jai", "Inside Hold Flag", 1);
                            exceptions.add(new OAException("XXGCO",
                                                           "XXTCO_CREDIT_LIMIT_CHECK",
                                                           null, OAException.ERROR,
                                                           null));
                        // One Party-One Account: Greater or Equal to 1 then throw error mesaage
                        if (i > 1) {
                            pageContext.writeDiagnostics("Jai-6",
                                                         "Inside Account Check",
                                                         1);
                            exceptions.add(new OAException("XXGCO",
                                                           "XXTCO_CREDIT_LIMIT_CHECK",
                                                           null, OAException.ERROR,
                                                           null));
                        if (exceptions.size() > 0) {
                            pageContext.writeDiagnostics("Jai-7",
                                                         "Inside Exceptioon calling",
                                                         10);
                            OAException.raiseBundledOAException(exceptions);
                        } else {
                            pageContext.writeDiagnostics("Jai-8",
                                                         "Inside else Exceptioon calling",
                                                         10);
                           // super.initParametersPFR(pageContext,webBean);
                            vbuttonBean.setFireActionForSubmit(null, null, null, false);
                            super.processFormRequest(pageContext, webBean);
    Please suggest the how to overcome with above mention issue.

    Hi Kiranmai,
    You can capture the event of the radio button in the following way in oninputprocessing.
    DATA: event             TYPE REF TO if_htmlb_data,
                   radioButton_event TYPE REF TO CL_HTMLB_EVENT_RADIOBUTTON.
             event = cl_htmlb_manager=>get_event( request ).
             IF event IS NOT INITIAL AND event->event_name = htmlb_events=>radiobutton.
               radioButton_event ?= event.
               ENDIF.
    you can get the attributes of clicked radio button in
    event->event_class
    event->event_id.
    event->event_name
    event->event_type
    event->event_server_name
    In layout define the radio button as
    <htmlb:radioButtonGroup   id          = "test_id">
            <htmlb:radioButton      id          = "id_red"   text = "Red"               onClick="myClick" />
            <htmlb:radioButton      id          = "id_blue"  text = "Blue"          onClientClick="alert('blue clicked')"/>
            <htmlb:radioButton      id          = "id_green" text = "Green"      onClick="myClick" onClientClick="alert('green clicked')"/>
          </htmlb:radioButtonGroup>
    Hope this will solve your problem.
    Donot forget to assign points for helpful answers.
    Regards
    Aashish Garg

  • Need help Take out the null values from the ResultSet and Create a XML file

    hi,
    I wrote something which connects to Database and gets the ResultSet. From that ResultSet I am creating
    a XML file. IN my program these are the main two classes Frame1 and ResultSetToXML. ResultSetToXML which
    takes ResultSet & Boolean value in its constructor. I am passing the ResultSet and Boolean value
    from Frame1 class. I am passing the boolean value to get the null values from the ResultSet and then add those
    null values to XML File. When i run the program it works alright and adds the null and not null values to
    the file. But when i pass the boolean value to take out the null values it would not take it out and adds
    the null and not null values.
    Please look at the code i am posing. I am showing step by step where its not adding the null values.
    Any help is always appreciated.
    Thanks in advance.
    ============================================================================
    Frame1 Class
    ============
    public class Frame1 extends JFrame{
    private JPanel contentPane;
    private XQuery xQuery1 = new XQuery();
    private XYLayout xYLayout1 = new XYLayout();
    public Document doc;
    private JButton jButton2 = new JButton();
    private Connection con;
    private Statement stmt;
    private ResultSetToXML rstx;
    //Construct the frame
    public Frame1() {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    try {
    jbInit();
    catch(Exception e) {
    e.printStackTrace();
    //Component initialization
    private void jbInit() throws Exception {
    //setIconImage(Toolkit.getDefaultToolkit().createImage(Frame1.class.getResource("[Your Icon]")));
    contentPane = (JPanel) this.getContentPane();
    xQuery1.setSql("");
    xQuery1.setUrl("jdbc:odbc:SCANODBC");
    xQuery1.setUserName("SYSDBA");
    xQuery1.setPassword("masterkey");
    xQuery1.setDriver("sun.jdbc.odbc.JdbcOdbcDriver");
    contentPane.setLayout(xYLayout1);
    this.setSize(new Dimension(400, 300));
    this.setTitle("Frame Title");
    xQuery1.setSql("Select * from Pinfo where pid=2 or pid=4");
    jButton2.setText("Get XML from DB");
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    catch(java.lang.ClassNotFoundException ex) {
    System.err.print("ClassNotFoundException: ");
    System.err.println(ex.getMessage());
    try {
    con = DriverManager.getConnection("jdbc:odbc:SCANODBC","SYSDBA", "masterkey");
    stmt = con.createStatement();
    catch(SQLException ex) {
    System.err.println("SQLException: " + ex.getMessage());
    jButton2.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(ActionEvent e) {
    jButton2_actionPerformed(e);
    contentPane.add(jButton2, new XYConstraints(126, 113, -1, -1));
    //Overridden so we can exit when window is closed
    protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
    System.exit(0);
    void jButton2_actionPerformed(ActionEvent e) {
    try{
    OutputStream out;
    XMLOutputter outputter;
    Element root;
    org.jdom.Document doc;
    root = new Element("PINFO");
    String query = "SELECT * FROM PINFO WHERE PID=2 OR PID=4";
    ResultSet rs = stmt.executeQuery(query);
    /*===========This is where i am passing the ResultSet and boolean=======
    ===========value to either add the null or not null values in the file======*/
    rstx = new ResultSetToXML(rs,true);
    } //end of try
    catch(SQLException ex) {
    System.err.println("SQLException: " + ex.getMessage());
    ======================================================================================
    ResultSetToXML class
    ====================
    public class ResultSetToXML {
    private OutputStream out;
    private Element root;
    private XMLOutputter outputter;
    private Document doc;
    // Constructor
    public ResultSetToXML(ResultSet rs, boolean checkifnull){
    try{
    String tagname="";
    String tagvalue="";
    root = new Element("pinfo");
    while (rs.next()){
    Element users = new Element("Record");
    for(int i=1;i<=rs.getMetaData().getColumnCount(); ++i){
    tagname= rs.getMetaData().getColumnName(i);
    tagvalue=rs.getString(i);
    System.out.println(tagname);
    System.out.println(tagvalue);
    /*============if the boolean value is false it adds the null and not
    null value to the file =====================*/
    /*============else it checks if the value is null or the length is
    less than 0 and does the else clause in the if(checkifnull)===*/
    if(checkifnull){ 
    if((tagvalue == null) || tagvalue.length() < 0 ){
    users.addContent((new Element(tagname).setText(tagvalue)));
    else{
    users.addContent((new Element(tagname).setText(tagvalue)));
    else{
    users.addContent((new Element(tagname).setText(tagvalue)));
    root.addContent(users);
    out=new FileOutputStream("c:/XMLFile.xml");
    doc = new Document(root);
    outputter = new XMLOutputter();
    outputter.output(doc,out);
    catch(IOException ioe){
    System.out.println(ioe);
    catch(SQLException sqle){

    Can someone please help me with this problem
    Thanks.

  • Closing the Statement returned from ResultSet.getStatement does not work

    With the ORACLE JDBC driver, I have discovered (the hard way) that it is essential to explictly close a Statement object after use. (http://www.orafaq.com/node/758 was useful here).
    Failure to do so leaves the Cursor open and eventually your application will fail with the ORA-01000 Too Many Cursors error.
    That works well if your code still has access to the Statement object which it created when it has finished with the results from executing the Statement.
    But, I've inherited some code where this is not the case. The results in the form of a ResultSet are passed through a few layers before it is eventually processed and can then be closed. The original Statement object is no longer available.
    I thought then that the solution would be use the ResultSet.getStatement method and to close that Statement.
    BUT that doesn't seem to work. The number of cursors continues to go up.
    Any ideas, anyone?
    (I'm using ojdbc6.jar and ORACLE 10g Express.)
    Edited by: Termind on 22-Jul-2010 10:00

    Copied in second message as first gets unreadable...
    eclipse.buildId=I20070625-1500
    java.version=1.5.0_18
    java.vendor=Sun Microsystems Inc.
    BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
    Command-line arguments:  -os win32 -ws win32 -arch x86 -data D:\Dokumente\Projekte\workspace
    Error
    Tue Sep 29 11:30:49 CEST 2009
    Unhandled event loop exception
    java.lang.NullPointerException
    at org.eclipse.jpt.db.internal.ForeignKey.getReferencedTable(ForeignKey.java:104)
    at org.eclipse.jpt.gen.internal.GenTable.addReferencedTablesTo(GenTable.java:106)
    at org.eclipse.jpt.gen.internal.GenScope.buildReferencedTables(GenScope.java:169)
    at org.eclipse.jpt.gen.internal.GenScope.configureManyToManyRelations(GenScope.java:81)
    at org.eclipse.jpt.gen.internal.GenScope.initialize(GenScope.java:46)
    at org.eclipse.jpt.gen.internal.GenScope.<init>(GenScope.java:33)
    at org.eclipse.jpt.gen.internal.PackageGenerator.<init>(PackageGenerator.java:48)
    at org.eclipse.jpt.gen.internal.PackageGenerator.generateEntities(PackageGenerator.java:38)
    at org.eclipse.jpt.ui.internal.generic.EntitiesGenerator$GenerateEntitiesRunnable.run(EntitiesGenerator.java:129)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1797)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1779)

  • ResultSet

    try
    Statement s = connection.createStatement();     
    ResultSet rs = s.executeQuery("SELECT E.date, FROM Event E");     
    try
      while (rs.next())
        java.sql.Date eventDate = rs.getDate(1);
        // Get Data from the Animal Table
        Statement s2 = connection.createStatement();
        ResultSet rs2 = s2.executeQuery("SELECT P.name, P.affiliation FROM ANIMAL P WHERE P.id=1");
        System.out.prinltn(rs2.getString(1)) // CASUES AN EXCEPTION TO BE THROWN.
      catch (SQLException sqle)
       System.out.println("ERROR");
    catch (SQLException e)
      System.out.println("OUTER CATCH " + e.getMessage());
    }I have no clue why I can't have two seperate ResultSet objects concurrently. They are initialized by seperate Statement objects. can anyone see the problem?
    When I execute the second query in the MYSQL Query Browser GUI, it works fine.
    Thank you.

    ResultSet rs = s.executeQuery("SELECT E.date, FROM Event E");That's not valid SQL. There's a comma where there shouldn't be one.
    db

  • Help with resultset from jdbc

    When I run this program, the result set show up in the results textarea but it does not start a new line after each record even after inserting the "\n" escape character
    import java.awt.*;
    import java.sql.*;
    import java.awt.event.*;
    import javax.swing.*;
    * @author wezi
    * A java program for keeping track of the inventory of
    * books belonging to the ACM bookclub of Riverside
    public class ACMBooks extends JFrame
         private JTabbedPane mainTab;
         private JPanel connectpane, querypane, processpane, adminpane;
         private JPanel quadpane[] = new JPanel[4];
         //components for pane 1
         private JTextField txtUser, txtPort, txtHost, txtdb;
         private JLabel lbluser, lblpasswd, lblport, lblhost, lbldb, lblstatus;
         private JPasswordField pwdconnect;
         private JButton btnConnect ;
         private String tooltip[] = {"Default Name = bookdb","",
                   "Default port for MySQL = 3306",
                    "Default host is localhost", "Default database is acmbooks"};
         //Components for pane 2
         private JPanel sqlpane, searchpane, resultspane;
         private JTextArea txaSQL, txaResults;
         private JButton btnQuery, btnSearch, btnReset;
         private JLabel lblAuthor, lblTitle, lblISBN, lblCategory;
         private JTextField txtauthor, txttitle, txtisbn, txtCat;
         private JScrollPane scroller;
         //Components for panel 3
         private JPanel checkIn, checkOut;
         private GridLayout gl,gl2, gl3;
         private GridBagLayout gbl = new GridBagLayout();
         private GridBagConstraints gbc = new GridBagConstraints();
         private GridBagConstraints gbc2 = new GridBagConstraints();
         //private String pwd;
         //Set up the GUI
         public ACMBooks()
              super("ACM Book Library");
              lbldb = new JLabel("Database");
              lblstatus = new JLabel("Connection settings");
              gl = new GridLayout(2,2);
              Container cont = getContentPane();
              mainTab = new JTabbedPane();
              connectpane = new JPanel();
              adminpane = new JPanel();
              //set up the connection pane GUI
              connectpane.setLayout(gl);
              for(int i=0; i<4; i++)
                   quadpane[i] = new JPanel();
                   connectpane.add(quadpane);
              gbc.insets = new Insets(0,20,0,0);
              quadpane[0].setLayout(gbl);
              lbluser = new JLabel("User Name:");
              gbc.anchor = GridBagConstraints.NORTHEAST;
              gbc.gridx = 0; gbc.gridy = 0;
              gbc.weightx = 0.5; gbc.weighty = 0.5;
              quadpane[0].add(lbluser,gbc);
              lblpasswd = new JLabel("Password:");
              gbc.gridx = 0; gbc.gridy = 1;
              quadpane[0].add(lblpasswd,gbc);
              lblport = new JLabel("Port:");
              gbc.gridx = 0; gbc.gridy = 2;
              quadpane[0].add(lblport,gbc);
              lblhost = new JLabel("Host:");
              gbc.gridx = 0; gbc.gridy = 3;
              quadpane[0].add(lblhost,gbc);
              lbldb = new JLabel("Database:");
              gbc.gridx = 0; gbc.gridy = 4;
              quadpane[0].add(lbldb,gbc);
              gbc.anchor = GridBagConstraints.NORTHWEST;
              gbc.insets = new Insets(0,10,0,0);
              gbc.gridx = 1; gbc.gridy = 0;
              txtUser = new JTextField(10);
              txtUser.setToolTipText("Default username = bookdb");
              quadpane[0].add(txtUser,gbc);
              gbc.gridx = 1; gbc.gridy = 2;
              txtPort = new JTextField(10);
              txtPort.setToolTipText("Default port = 3306");
              quadpane[0].add(txtPort,gbc);
              gbc.gridx = 1; gbc.gridy = 3;
              txtHost = new JTextField(10);
              txtHost.setToolTipText("Default host = localhost");
              quadpane[0].add(txtHost,gbc);
              gbc.gridx = 1; gbc.gridy = 4;
              txtdb = new JTextField(10);
              txtdb.setToolTipText("Default database = acmbooks");
              quadpane[0].add(txtdb,gbc);
              pwdconnect = new JPasswordField(10);
              gbc.gridx = 1; gbc.gridy = 1;
              quadpane[0].add(pwdconnect,gbc);
              //Create a connection button
              btnConnect = new JButton("Connect");
              gbc.anchor = GridBagConstraints.NORTHWEST;
              gbc.gridx = 2; gbc.gridy = 4;
              quadpane[0].add(btnConnect,gbc);
              //create the reset button
              btnReset = new JButton(" Reset ");
              btnReset.setSize(btnConnect.getHeight(),btnConnect.getWidth());
              gbc.gridx = 2; gbc.gridy = 3;
              quadpane[0].add(btnReset,gbc);
    //Connection status
              lblstatus = new JLabel();
              quadpane[3].setLayout(gbl);
              gbc.anchor = GridBagConstraints.SOUTHEAST;
              gbc.insets = new Insets(0,10,20,20);
              quadpane[3].add(lblstatus,gbc);
              //Add a border to the first pane & add it to the main container
              quadpane[0].setBorder(BorderFactory.createTitledBorder("Details"));
              mainTab.addTab("Connection Settings",null,connectpane,"connections");
              //Create the second tab (Query pane)
              querypane = new JPanel();
              GridBagLayout gblquery= new GridBagLayout();
              GridBagConstraints gbcquery = new GridBagConstraints();
              gl2 = new GridLayout(4,1);
              querypane.setLayout(gblquery);
              //The sql query pane
              sqlpane = new JPanel();
              sqlpane.setLayout(gbl);
              gbc2.gridx = 0; gbc2.gridy = 0;
              gbc2.weightx = 0.5; gbc2.weighty = 0.5;
              txaSQL = new JTextArea(4,44);
              txaSQL.setBorder(BorderFactory.createLoweredBevelBorder());
              gbc2.anchor = GridBagConstraints.NORTHWEST;
              gbc2.insets = new Insets(0,10,0,0);
              sqlpane.add(txaSQL,gbc2);
              gbc2.gridx = 1; gbc2.gridy = 0;
              btnQuery = new JButton("Enter Query");
              gbc2.insets = new Insets(0,16,5,10);
              gbc2.anchor = GridBagConstraints.SOUTHEAST;
              sqlpane.add(btnQuery,gbc2);
              sqlpane.setBorder(BorderFactory.createTitledBorder("SQL Queries:"));
              gbcquery.gridheight =1; gbcquery.gridwidth = 1;
              gbcquery.gridx = 0; gbcquery.gridy = 0;
              gbcquery.anchor = GridBagConstraints.NORTHWEST;
              gbcquery.weightx = 0.5; gbcquery.weighty =0.5;
              gbcquery.fill =GridBagConstraints.REMAINDER;
              gbcquery.insets = new Insets(0,0,2,0);
              gbcquery.ipadx = 1; gbcquery.ipady = 1;
              querypane.add(sqlpane,gbcquery);
              //The search by pane
              searchpane = new JPanel();
              searchpane.setLayout(gbl);
              gbc2.insets = new Insets(0,14,5,5);
              lblAuthor = new JLabel("Author:");
              gbc2.anchor = GridBagConstraints.NORTHEAST;
              gbc2.gridx = 0; gbc2.gridy = 0;
              searchpane.add(lblAuthor,gbc2);
              lblTitle = new JLabel("Title:");
              gbc2.gridx = 0; gbc2.gridy = 1;
              searchpane.add(lblTitle,gbc2);
              lblISBN = new JLabel("ISBN:");
              gbc2.gridx = 2; gbc2.gridy = 0;
              searchpane.add(lblISBN,gbc2);
              lblCategory = new JLabel("Category:");
              gbc2.gridx = 2; gbc2.gridy =1;
              searchpane.add(lblCategory,gbc2);
              txtauthor = new JTextField(15);
              gbc2.gridx = 1; gbc2.gridy = 0;
              gbc2.anchor = GridBagConstraints.NORTHWEST;
              searchpane.add(txtauthor,gbc2);
              txttitle = new JTextField(15);
              gbc2.gridx = 1; gbc2.gridy = 1;
              searchpane.add(txttitle,gbc2);
              txtisbn = new JTextField(15);
              gbc2.gridx = 3; gbc2.gridy = 0;
              searchpane.add(txtisbn,gbc2);
              txtCat = new JTextField(15);
              gbc2.gridx = 3; gbc2.gridy = 1;
              searchpane.add(txtCat,gbc2);
              btnSearch = new JButton("Search >>>");
              gbc2.anchor = GridBagConstraints.SOUTHEAST;
              gbc2.gridx = 4; gbc2.gridy = 1;
              gbc2.insets = new Insets(0,5,20,10);
              searchpane.add(btnSearch,gbc2);
              searchpane.setBorder(BorderFactory.createTitledBorder("Search By:"));
              gbcquery.gridheight =1; gbcquery.gridwidth = 1;
              gbcquery.gridx = 0; gbcquery.gridy = 1;
              gbcquery.insets = new Insets(0,0,0,0);
              querypane.add(searchpane,gbcquery);
              //The results pane
              resultspane = new JPanel();
              resultspane.setSize(20,60);
              resultspane.setLayout(gbl);
              gbc2.gridx = 0; gbc2.gridy = 0;
              gbc2.anchor = GridBagConstraints.NORTHWEST;
              txaResults = new JTextArea(" ",9,55);
              scroller = new JScrollPane(txaResults);
              resultspane.add(new JScrollPane(txaResults));
              txaResults.setBorder(BorderFactory.createLoweredBevelBorder());
              resultspane.add(txaResults,gbc2);
              resultspane.setBorder(BorderFactory.createTitledBorder("Results:"));
              gbcquery.gridheight =3; gbcquery.gridwidth = 1;
              gbcquery.gridx = 0; gbcquery.gridy = 2;
              gbcquery.weightx = 1; gbcquery.weighty = 1;
              querypane.add(resultspane,gbcquery);
              mainTab.addTab("Query Entry",null,querypane,"Query page");
              //Create a third tab to process book checkin and out
              processpane = new JPanel();
              gl3 = new GridLayout(4,1);
              processpane.setLayout(gl3);
              //Create the checkin panel
              checkIn = new JPanel();
              checkIn.setBorder(BorderFactory.createTitledBorder("Return Books"));
              checkIn.setLayout(gbl);
              //Create the checkout panel
              checkOut = new JPanel();
              checkOut.setBorder(BorderFactory.createTitledBorder("Check Books Out"));
              processpane.add(checkOut,gl3);
              processpane.add(checkIn,gl3);
              mainTab.addTab("Process Books",null, processpane,"Book Processing page");
              //Create an administration panel
              adminpane = new JPanel();
              mainTab.addTab("Admin",null,adminpane,"Administration page");
              cont.add(mainTab);
              //Register the eventhandlers
              ButtonHandler btnHandler = new ButtonHandler();
              btnConnect.addActionListener(btnHandler);
              btnQuery.addActionListener(btnHandler);
              btnSearch.addActionListener(btnHandler);
              btnReset.addActionListener(btnHandler);
              setSize(650,460);
              setVisible(true);
         }//end constructor
         private class ButtonHandler implements ActionListener
              public void actionPerformed(ActionEvent e)
                   String errMsg;
                   Statement stmt;
                   ResultSet rs;
                   Connection con = null;
                   String pwd;
                   String user;
                   //Create a url from user input
                   String url = "jdbc:mysql://";
                   url += txtHost.getText();
                   url += ":";
                   url += txtPort.getText();
                   url += "/";
                   url += txtdb.getText();
              try
                   //Register the JDBC Mysql Driver
                   Class.forName("com.mysql.jdbc.Driver");
                   //Get the password and user name for the database
                   pwd = new String(pwdconnect.getPassword());
                   user = new String(txtUser.getText());
                   //Open a connection to the database
                   con = DriverManager.getConnection(url,user,pwd);
                        //Add the action event for the btnReset
                        if(e.getSource() == btnReset)
                             //Clear all the text fields and the status label
                             lblstatus.setText(" ");
                             txtUser.setText(" ");
                             txtdb.setText(" ");
                             txtHost.setText(" ");
                             txtPort.setText(" ");
                             pwdconnect.setText("");
                             txaResults.setText(" ");
                             txaSQL.setText(" ");
                             try{
                                  if(!con.isClosed())
                                       con.close();
                             catch(Exception closeError)
                                  String clErr = new String(closeError.toString());
                                  txaResults.setText(clErr);
                        }//end btnReset
                   //If the connect button is pressed
                   if(e.getSource() == btnConnect)
                   if(!con.isClosed())//if connection is open
                        lblstatus.setText("");
                        lblstatus.setVisible(true);
                        lblstatus.setText("Connected to " + txtdb.getText()
                             +" on "     + txtHost.getText());
                   else
                   { lblstatus.setText("Not Connected"); }
                   }//end btnConnect
                   if(e.getSource() == btnQuery || e.getSource()== txaSQL)
                        String strQuery = new String(txaSQL.getText());
                        ResultSetMetaData rsmtd;
                        int numCol;
                        try
                             stmt = con.createStatement();
                             rs = stmt.executeQuery(strQuery);
                             rsmtd = rs.getMetaData(); //to get metadata
                             numCol = rsmtd.getColumnCount(); //for number of columns
                             String strCol[] = new String[numCol];
                             String colName[] = new String[numCol];
                             String txaColumn = new String("");
                             String strHeading = new String("");
                             //Write the results of the query to the results text area
                             txaResults.setText(" ");          
                             //Get the data from the result set
                             //first get the column headings
                             for(int i=1; i<=numCol; i++)
                                  colName[i-1] = rsmtd.getColumnName(i);
                                  strHeading += colName[i-1] + "\t";
                             txaResults.setText(strHeading + "\n");
                             while(rs.next())
                                  //Get the values & create a display column
                                  for(int i=1; i<=numCol; i++)
                                       strCol[i-1] = rs.getString(i);
                                       txaColumn += strCol[i-1] + "\t";
                                  }//end for
                                  //Display the values
                                  txaResults.append( txaColumn + "\n");
                        catch(Exception sqlError)
                             txaResults.setText("");
                             String strSqlErr = new String(sqlError.toString());
                             txaResults.setText(strSqlErr);
                   }//end btnQuery
                   if(e.getSource() == btnSearch)
                        try
                             String strAuthor = new String(txtauthor.getText());
                             String strISBN = new String(txtisbn.getText());
                             String strTitle = new String(txttitle.getText());
                             String strCat = new String(txtCat.getText());
                             * Need to add code to change the search fields to
                             * any if the field is blank i.e if the field is blank
                             * search using a wild card. If all fields are blank, then
                             * do not search at all.
                             stmt = con.createStatement();
                             rs = stmt.executeQuery("Select * from books where" +
                                       " bookAuthor = " + strAuthor +
                                       " bookISBN = " + strISBN +
                                       " bookTitle = " + strTitle +
                                       "bookCategory = " + strCat);
                        catch(Exception searchError)
                             errMsg = new String(searchError.toString());
                             txaResults.setText("");
                             txaResults.setText(errMsg);
                   }//end btnSearch
              catch(Exception connectError)
                   errMsg = new String(connectError.toString());
                   lblstatus.setText("");
                   lblstatus.setText(errMsg);
              }//end actionPer
         }//end ButtonHandler
         public static void main(String[] args)
              ACMBooks app = new ACMBooks();
              app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         }//end main
    }//end class ACMBooks

    Hi,
    Here is a template of Manifest file which you can use for your reference:
    Manifest-Version: 1.0
    Created-By: Apache Ant 1.5.1
    Main-Class: com.pkg1.pkg2.MainClass
    Class-Path: . ./libs/ ./libs/database-driver.jar ./libs/jdom.jar ./libs/xercesImpl.jar ./libs/log4j.jar ....
    Name: com.pkg1.pkg2Main-Class: Specify the main class with complete package name
    Class-Path: Put all the jar file name with path
    <b>So the solution to your problem is to put you jar file name with the relative or complete path</b>
    Thanks
    Duke.

  • How can i implement a mouse listener event on jtable cell?

    I create JTable using a resultset,at the end of each row i add an image using JLabel(set imageicon of the JLabel).
    i want to track the event when user click on that image.
    What can i do for that?.
    I tried by implementing mouseListener interface for the JLabel but it's not working properly.

    Hi,
    Add MouseListener to the JTable.
    when the user clicks on the table use the method
    getValueAt( int selectedRow,int selectedColumn) to get the contents.
    Object obj = getValueAt( int selectedRow,int selectedColumn) .
    (If obj instance of JLabel)
    do your functionality.
    Hope this helps
    Cheers :)
    Nagaraj

  • Problem with Calendar showing first day events

    In my Java Bean, i have the following:
    public ResultSet getEvents(GregorianCalendar start, GregorianCalendar end)
              ResultSet rs = null;
              java.sql.Timestamp startDate = new java.sql.Timestamp(start.getTimeInMillis());
              java.sql.Timestamp endDate = new java.sql.Timestamp(end.getTimeInMillis());
              try {
              ps = con.prepareStatement("select * from events where startDate = '" + startDate + "' and startDate <= '" + endDate + "' order by startTime");
              rs = ps.executeQuery();
              catch (SQLException sqle) {}
              return rs;
    When ever my JSP page calls for this, it will not show the first day of the month Events. What am i doing wrong?

    I would guess that there's an SQLException being thrown, probably due to your database not liking the toString() output of Timestamp. Your code is eating SQLExceptions, though, so you'll never see the error.
    You've gone to the trouble of creating Timestamp objects, use them appropriately:ps = con.prepareStatement("select * from events where startDate >= ? and startDate <= ? order by startTime");
    ps.setTimestamp(1, startDate);
    ps.setTimestamp(2, endDate);
    rs = ps.executeQuery();
    ...

  • How to generate a report on 'Event Received' events for a resource objects

    Hello,
    I want to generate a report on all the recon events which are in 'Event Received' status, on a daily basis. Can you please let me know how to do this and what all tables are involved?
    Thanks

    Well thats pretty simple. Actually there are multiple tables in OIM database responsible for holding reconciliation data but event information is stored in one table RCE. So there are two simple ways to do that as follows:
    *1) Using OIM API ::*
    There is an API exposed (*findReconciliationEvent()*) in the tcReconciliationOperationsIntf interface. You can just pass a HashMap with one filter parameter for ReconEvent status as Event Received. In addition to it this API also requires the StartDate and EndDate (You can give current date for both arguments). This will return you a ResultSet containing all the events which are in that particular state. Just iterate through the ResultSet for all the event information ad create your report.
    *2) Using OIM database query::*
    Just write an SQL query to run in the database schema. Let's assume you have written a scheduler for the same. This is the code for your class:
    tcDataSet dsList = new tcDataSet();
    String query = " select * from RCE where RCE_STATUS='Event Received' ";
    log.debug(query);
    try {
    dsList.setQuery(getDataBase(), query);
    dsList.executeQuery();
    if (!dsList.isEmpty()){
    log.debug("Total Rows Found:" + dsList.getTotalRowCount());
    result = true;
    for (int i = 0; i < dsList.getTotalRowCount(); i++) {
    Write your custom logic here for generation of report
    }else{
    log.debug("No Events Found");
    result = false;
    } catch (tcDataSetException e) {
    e.printStackTrace();
    result = false;
    So you can do it both ways.
    Thanks
    Sunny

  • Why are all the events in the XML SAX parser not activated?

    Hi everyone,
    I have written a mini server that parses XML files into SQL queries.
    Below is a segment of my code;
              try          {                                                       
                   Class.forName( JDBC_DRIVER );
                   myConnection = DriverManager.getConnection( DATABASE_URL, "username", "password");                                                  
                   EventXMLParser myEXP = new EventXMLParser(directory, myConnection);
                   File[] xmlFiles = directory.listFiles();
                   for (File xmlFile : xmlFiles)               {     
                        myEXP.XMLtoDB(xmlFile);
                        outWriter.println("File:" + xmlFile.getName() + " DONE");
              } catch (SQLException e)     {
                   System.err.println("SQLException for establishing connection");
                   e.printStackTrace();
              } catch (ClassNotFoundException e)     {
                   System.err.println("CLASS NOT FOUND EXCEPTION HERE");
                   e.printStackTrace();
              } catch (Exception e)     {
                   System.err.println(e);
                   e.printStackTrace();
              finally {
                   outWriter.println("PARSING COMPLETED");
                   outWriter.close();
         }Where the constructor EventXMLParser constructs the following:
         public EventXMLParser(File path, Connection connection)     {
              super();
              try     {
                   this.XMLpath = path;
                   this.db_connection = connection;
                   this.xr = XMLReaderFactory.createXMLReader();
                   this.XMLSAXhandler  = new DefaultHandler(); //create a new own handler
                   this.xr.setContentHandler(XMLSAXhandler);
                   this.xr.setErrorHandler(XMLSAXhandler);
                   //System.out.println("DEBUG: db_connection is " + db_connection.toString());
              catch (Exception e)     {
                   System.out.println("Constructor Error!");
                   e.printStackTrace();
         }Below are all my helper methods within EventXMLParser.java
         public void XMLtoDB(String XMLpath) throws Exception  {
              try     {
                   //Input
                   System.out.println("XMLpath is : " + XMLpath);
                   /*FileReader r = new FileReader(XMLpath); debug
                   InputSource in = new InputSource(r);
                   xr.parse(in);
                   xr.parse(XMLpath);
                   /* Note that while parsing, the end of each event, </event>
                    * will trigger sendSQL to execute the query on the database
              catch (Exception e)     {
                   throw new Exception("Error with XMLtoDB!! Exception: " + e);
         public void sendSQL(Event event, Connection sql_connection) throws SQLException     {
                   //JDBC part
                   try     {
                        System.err.println("DEBUG sendSQL");
                        Statement sql_statement = sql_connection.createStatement();
                        ResultSet resultSet = sql_statement.executeQuery( event.toSQL() );
                   catch (SQLException e)     {
                        e.printStackTrace();
         /* Parsing XML
          * From here onwards it's all designed for the SAX Parsing with different event calling methods
         public void startDocument()     {
              System.err.println("Start Document");
         public void endDocument()     {
              System.err.println("End Document");
         public void startElement(String uri, String name, String qName, Attributes atts)     {
              CurrentElement= name;
              System.out.println("This is parsing");
         public void characters(char ch[], int start, int length)     {
              SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
              StringBuffer sb = new StringBuffer();
              for (int i = start; i < start + length; i++)     
                   sb.append(ch);
              String content = sb.toString();
              if (CurrentElement.equals("eid"))
                   temp.setEventID( (Integer.valueOf(content)).intValue() ) ;
              else if (CurrentElement.equals("sd"))
                   temp.setShort_description(content);
              else if (CurrentElement.equals("ld"))
                   temp.setLong_description(content);
              else if ( (CurrentElement.equals("dt")))
                   temp.setDate_Time( formatter.parse(content, new ParsePosition(0)) );
              else if (CurrentElement.equals("repeat"))
                   temp.setRepeat_pattern( (Integer.valueOf(content)).intValue() );
              else if (CurrentElement.equals("valid"))
                   temp.setValid_period(content);
              else if (CurrentElement.equals("status"))     {
                   temp.setStatus( (Integer.valueOf(content)).intValue() );
              else {}
         public void endElement(String uri, String name, String qName)     {
              System.err.println("DEBUG" + temp.toString()); /*debug*/
              if (name.equals("event"))     {
                   try     {
                        /*debug*/ temp.setUserID(1);
                        /*debug*/ System.err.println("DEBUG: " + temp.toString());
                        sendSQL(temp, db_connection);
                        //temp = new Event();
                   catch (SQLException e)     {
                        System.err.println(e);
                   }//end catch
              }//end try
    Where event is a public class Event     {
         //fields
         private int userID = 1; // = 1 only applies for testing
         private int eventID;
         private String short_description;
         private String long_description;
         private Date date_time = null;
         private int repeat_pattern;
         private String valid_period;
         private int status;     //1 for new, 0 for modification and -1 for delete
         SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
         //Constructors
         //every event requires the following: userID eventID and short_Description
         public Event(int uID, int eID, String shortDescrp)     {
              setUserID(uID);
              setEventID(eID);
              setShort_description(shortDescrp);
         public Event(int uid, int eid, String sd,
                                  String ld, Date d_t, int r_p, String v_p, int s)     {
              setUserID(uid);
              setEventID(eid);
              setShort_description(sd);
              setLong_description(ld);
              setDate_Time(d_t);
              setRepeat_pattern(r_p);
              setValid_period(v_p);
              setStatus(s);
         //set
         public void setUserID (int x)                         { this.userID = x ;}
         public void setEventID (int x)                         { this.eventID = x ;}
         public void setShort_description (String x)          { this.short_description = x ;}
         public void setLong_description (String x)          { this.long_description = x ;}
         public void setDate_Time(Date x)                    { this.date_time = x ;}
         public void setRepeat_pattern (int x)               { this.repeat_pattern = x ;}
         public void setValid_period (String x)               { this.valid_period = x ;}
         public void setStatus (int x)                         { this.status = x; }
         //get
         public int           getUserID()                              { return this.userID;}
         public int           getEventID()                         { return this.eventID;}
         public String      getShort_description()               { return this.short_description;}
         public String      getLong_description()               { return this.long_description;}
         public Date        getDate_Time()                         { return this.date_time;}
         public int         getRepeat_pattern()                    { return this.repeat_pattern;}
         public String      getValid_period()                    { return this.valid_period;}
         public int           getStatus()                              { return this.status; }
         //Event to SQL statements;
         public String toSQL()     {
              StringBuffer sb = new StringBuffer();
              ///if ( status == 1)     {
                   sb.append( "INSERT INTO events SET" );
                   sb.append( " userID = " + userID + ", ");
                   sb.append( "eventID = " + eventID + ", " );
                   sb.append( "short_description = " + "\'" + short_description + "\'" + ", "); //String
                   sb.append( "long_description = " + "\'" + long_description + "\'"  + ", "); //String
                   sb.append( "date_time = " + "\'" + formatter.format(date_time) + "\'" + ", ");
                   sb.append( "repeat_pattern = " + repeat_pattern + ", " );
                   sb.append( "valid_period = " + "\'" + valid_period + "\'" ); //String
                   sb.append( ";");
              //} else if ( status == 2)      {
              System.err.println(sb.toString());
              return sb.toString();
    }     My question is: I have taken my SQL query generated by toSQL() method in events and it worked.
    Here is the funny thing:
    Everything is correct syntax wise: No complaints what soever
    The mysql part works: Tested separately.
    So I tend to think that the problem lies within the SAX parser. I have written SAX2 parsers on this machine before and they have worked too. I tried inserting println statements all over startElement endElement etc etc only to find out that the SAX parser did not call any of the methods that I overided!! Why is that so?
    Can you guys spot where my SAX parser fails?

    I see.
    I try to correct this problem by removing super();
    so right now my code looks like this:
         static Event temp = new Event(0, 0, "null", "null", new Date(), 0, "null", 0);
         static String CurrentElement = null;
         static File XMLpath;
         static Connection db_connection;
         static XMLReader xr;
         static DefaultHandler XMLSAXhandler; 
         //Constructor,      Build the SAX Parser
         public EventXMLParser(File path, Connection connection)     {
              try     {
                   this.XMLpath = path;
                   this.db_connection = connection;
                   this.xr = XMLReaderFactory.createXMLReader();
                   this.XMLSAXhandler  = new DefaultHandler(); //create a new own handler
                   this.xr.setContentHandler(XMLSAXhandler);
                   this.xr.setErrorHandler(XMLSAXhandler);
                   //System.out.println("DEBUG: db_connection is " + db_connection.toString());
              catch (Exception e)     {
                   System.out.println("Constructor Error!");
                   e.printStackTrace();
         }This time, I created a new instance of default handler() which can be referenced by as the objects's XMLSAXhandler. However, that did not solve the problem, why does the problem still persist?
    Right now, there is only one instance of a default handler created. So why does all my parsing event functions still get ignored?

Maybe you are looking for

  • Error while assigning the persons to the Project activities

    Dear Experts, In Workforce planning, I am facing the below error No requirements were found for the selection criteria Message no. C#043 I have created a project and assigned the work center to the activities, the work center is having the persons as

  • DW CS3 effects

    Dear Sirs I'm using the DW CS3 trial to understand if the Spry effects can be useful to my work. In these pages I used one effect (don't know the english definition) but one see a litte flash of the entire image before it grows from 0% to 100%. Is it

  • The slow loading is unbearable

    Recently I have found that whenever I go to the "Apple Discussions" page & then to any of the forums it takes forever for the page to load! Like right now it took 20-30 seconds to load the "discussions" page & 30-40 seconds to load this forum's page.

  • Will FCS 3 work under lion?

    Hi (Bonjour)! I'm currently in the move for renewing my aging LNE station. I already own an unopened FCS 3 box but looking for a new mac. I 'm pretty cold with the new FCP X . Anyone knows if Final Cut Studio 3 will works under the upcoming OS X Lion

  • Can you restore a previous backup?

    Ok, this might sound confusing. I had hardware malfunctions with my first iphone4. I just got my new one, and I think I accidentally deleted the last backup that I did on the old one. Is there anyway to bring it back? My contacts came back, as did my