Query behave strange when called from java

Hi,
I had the same scenario a few times in two different queries in different databases (10g v2) and so not putting the query.
When I run the query from sqlplus/toad it takes less than a second
When I run it from java it takes about 5 minutes.
I could have thought it is something to do with Java ...
But when I rename the underlying table and use the new name in the query it takes normal (less than a second) time both in java and sqlplus/toad.
Before changing the name, I have tried rebuilidng the indexes and analyzing the table. The table has about 10 million rows and 13 indexes in one scenario and as less as 400k with 3 indexes in the other scenario. and in both cases updated once daily.
Each time this happends either a rename or dropping and recreating the table is solving the problem. I am lost.. any ideas what might be causing this problme; any solutions.
Thanks

Do whatever it is you are doing that makes it faster and run an Explain Plan capturing the output with DBMS_XPLAN. Also save off the stats collected on the table and indexes
Then, when performance deteriorates capture another plan along with the stats.
What is different?
A table with 13 indexes is an indication of an issue. I would suggest someone take a good look at why so many indexes are there.

Similar Messages

  • How stored procedure get executed when called from java

    When we create a stored procedure or function in oracle, it is compiled and stored there. From java when we call them no compilation is performed its a simple call. When a function or stored procedure is invoked from multiple instance of java objects(for a single session), does the stored procedure clone it self so that it can be called by different java objects which I think not possible at all. In such cases when one java object is interacting with the stored procedure, does other java objects go on a wait state. What happens if sessions are different.
    Please help.

    >
    does oracle creates multiple instance of a particular stored procedure for different sessions or connections. if not then there might be some kind of waiting principle followed.. what happens exactly
    >
    What happens exactly is detailed in Chap. 14 Memory Architecture ni the Database concepts doc
    http://docs.oracle.com/cd/E14072_01/server.112/e10713/memory.htm#i21266
    The code is shared but the data isn't (see the lone exception to this below).
    See the section on the Library Cache
    >
    Program Units and the Library Cache
    The library cache holds executable forms of PL/SQL programs and Java classes. These items are collectively referred to as program units.
    The database processes program units similarly to SQL statements. For example, the database allocates a shared area to hold the parsed, compiled form of a PL/SQL program. The database allocates a private area to hold values specific to the session that runs the program, including local, global, and package variables, and buffers for executing SQL. If multiple users run the same program, then each user maintains a separate copy of his or her private SQL area, which holds session-specific values, and accesses a single shared SQL area.
    >
    The exception is when code uses the SERIALLY_REUSABLE pragma. In that case the memory for package state is in the SGA and users do not have their own copy in their UGA.
    See the SERIALLY_REUSABLE pragma in the PL/SQL Language doc
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/seriallyreusable_pragma.htm
    >
    The global memory for serially reusable packages is pooled in the System Global Area (SGA), not allocated to individual users in the User Global Area (UGA). That way, the package work area can be reused. When the call to the server ends, the memory is returned to the pool. Each time the package is reused, its public variables are initialized to their default values or to NULL.
    Serially reusable packages cannot be accessed from database triggers or other PL/SQL subprograms that are called from SQL statements. If you try, the database generates an error.

  • Executable behaving different when called f/Java

    I have an executable that is run from the command line which behaves differently when I run it from my application. The executable takes MP3s files as arguments and merges them together. When I use large files from within my app, it doesn't respond, but using the same files from the command line works fine. I was thinking it might be a memory thing, but the executable should get its own space seperate from the VM. Does anyone have any suggestions? Thanks!

    I do not have the source for the executable, so I wouldn't be able to pull lines out of there. It works from my Java app when I pass in smaller files, so I know I have the syntax correct, but with larger files it hangs. When I run the same thing from the command line with the larger files it runs like a champ. I was trying to use my task manager (I'm on Win NT) to look at memory usage since the only variable seems to be file size, but nothing seems to indicate it is a memory issue.

  • JavaFX hangs when called from Java

    Hello
    I am developing a java application with a JavaFX gui, the communication from Java works with an java interface. The communication works,but after a few updates the javaFX code hangs and subsequently the Java code also hangs.
    Is this a common problem, and so is there a common solution for this.

    JavaFX UI calls need to be done on the Event Thread. So if your Java Application has multiple threads or runs on a different Thread to need to wrap all callbacks to JavaFX in a deferAction like this:
    class YourFXClass extends YourJavaInterface {
       override public function someMethod(someArgument) {
            FX.deferAction(function() : Void {
                  // doSomething with someArgument
        }

  • Errer when, Call from java to pl sql procedure with table out parameter

    Hi ,
    Please help me ? It's urgent for me .....
    My Oracle Code is like this ,
    CREATE TABLE TEST_TABLE ( DATE1 DATE, VALUE_EXAMPLE VARCHAR2(20 BYTE), VALUE2_EXAMPLE VARCHAR2(20 BYTE), VALUE3_EXAMPLE NUMBER ); CREATE OR REPLACE TYPE TONERECORDTEST AS OBJECT ( DATE1 DATE, VALUE_EXAMPLE VARCHAR2(20), VALUE2_EXAMPLE VARCHAR2(20), VALUE3_EXAMPLE NUMBER ); CREATE OR REPLACE TYPE TTESTTABLE IS TABLE OF TONERECORDTEST; CREATE OR REPLACE PACKAGE test_collection_procedures AS PROCEDURE testCallProcedureFromJava(start_time IN DATE, end_time IN DATE, table_data OUT TTesttable); END test_collection_procedures; / CREATE OR REPLACE PACKAGE BODY test_collection_procedures AS PROCEDURE testCallProcedureFromJava(start_time IN DATE, end_time IN DATE, table_data OUT TTesttable) IS BEGIN SELECT TONERECORDTEST(date1, value_example, value2_example, value3_example) BULK COLLECT INTO table_data FROM TEST_TABLE WHERE DATE1>=start_time AND DATE1<=end_time; END testCallProcedureFromJava; END test_collection_procedures;
    And my Java Code is like
    import java.sql.Connection; import java.sql.DriverManager; import oracle.jdbc.OracleCallableStatement; import oracle.jdbc.OracleTypes; import oracle.sql.ARRAY; import oracle.sql.ArrayDescriptor; import oracle.sql.STRUCT; import oracle.sql.StructDescriptor; public class testPLCollectionType { public static void main(java.lang.String[] args) { try{ //Load the driver Class.forName ("oracle.jdbc.driver.OracleDriver"); // Connect to the database Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@serverbd:1521:squema1","user", "password"); // First, declare the Object arrays that will store the data (for TONERECORDTEST OBJECT TYPE) Object [] p2recobj; Object [] p3recobj; Object [] p4recobj; // Declare the Object Arrays to hold the STRUCTS (for TTESTTABLE TYPE) Object [] p2arrobj; // Declare two descriptors, one for the ARRAY TYPE // and one for the OBJECT TYPE. StructDescriptor desc1=StructDescriptor.createDescriptor("TONERECORDTEST",conn); ArrayDescriptor desc2=ArrayDescriptor.createDescriptor("TTESTTABLE",conn); // Set up the ARRAY object. ARRAY p2arr; // Declare the callable statement. // This must be of type OracleCallableStatement. OracleCallableStatement ocs = (OracleCallableStatement)conn.prepareCall("{call test_collection_procedures.testCallProcedureFromJa va(?,?,?)}"); // Declare IN parameters. Realize that are 2 DATE TYPE!!! Maybe your could change with setDATE ocs.setString(1,"01-JAN-04"); ocs.setString(2,"10-JAN-05"); // Register OUT parameter ocs.registerOutParameter(3,OracleTypes.ARRAY,"TTESTTABLE"); // Execute the procedure ocs.execute(); // Associate the returned arrays with the ARRAY objects. p2arr = ocs.getARRAY(3); // Get the data back into the data arrays. //p1arrobj = (Object [])p1arr.getArray(); p2arrobj = (Object [])p2arr.getArray(); System.out.println("Number of rows="+p2arrobj.length); System.out.println("Printing results..."); for (int i=0; i<p2arrobj.length; i++){ Object [] piarrobj = ((STRUCT)p2arrobj).getAttributes();
    System.out.println();
    System.out.print("Row "+i);
    for (int j=0; j<4; j++){
    System.out.print("|"+piarrobj[j]);
    }catch (Exception ex){
    System.out.println("Exception-->"+ex.getMessage());
    Actually when i running the java program it is showing error
    Exception-->ORA-06550: line 1, column 58:
    PLS-00103: Encountered the symbol "VA" when expecting one of the following:
    := . ( @ % ;
    The symbol ":=" was substituted for "VA" to continue.
      I am not getting the error .Please help me out Dhabas Edited by: Dhabas on Jan 12, 2009 3:49 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    // Declare the callable statement.
    // This must be of type OracleCallableStatement.
    ..."{call test_collection_procedures.testCallProcedureFromJa va(?,?,?)}");Looks like Ja divorced va.

  • Java.lang.UnsatisfiedLinkError: when called from a jar file

    I have a class that calls a custom dll file. If I dont package the class files and set my system PATH to the location of the DLL then the VM is able to find the dll and load it successfully.
    However, when I package the class files into a jar file, I get "java.lang.UnsatisfiedLinkError: NetworkAdapters" eventhough the system PATH is set to the correct location.
    I have also tried to packaging the dll with the class files but this has not made any difference.
    Library is called from Java as follows:
    static {
    System.loadLibrary("NetworkAdapters");
    When packaged the classes files exist in the following sub directories com\instem\hci\adapters
    Any help appreciated.

    Is it an executable Jar file?
    The the DLL needs to sit in the same folders as the Jar itself.
    (works for us).

  • Query response time takes more time when calling from package

    SELECT
    /* UTILITIES_PKG.GET_COUNTRY_CODE(E.EMP_ID,E.EMP_NO) COUNTRY_ID */
    (SELECT DISTINCT IE.COUNTRY_ID
    FROM DOCUMENT IE
    WHERE IE.EMP_ID =E.EMP_ID
    AND IE.EMP_NO = E.EMP_NO
    AND IE.STATUS = 'OPEN' ) COUNTRY_ID
    FROM EMPLOYEE E
    CREATE OR REPLACE PACKAGE BODY UTILITIES_PKG AS
    FUNCTION GET_COUNTRY_CODE(P_EMP_ID IN VARCHAR2, P_EMP_NO IN VARCHAR2)
    RETURN VARCHAR2 IS
    L_COUNTRY_ID VARCHAR2(25) := '';
    BEGIN
    SELECT DISTINCT IE.COUNTRY_ID
    INTO L_COUNTRY_ID
    FROM DOCUMENT IE
    WHERE IE.EMP_ID = P_EMP_ID
    AND IE.EMP_NO = P_EMP_NO
    AND IE.STATUS = 'OPEN';
    RETURN L_COUNTRY_ID;
    EXCEPTION
    WHEN OTHERS THEN
    RETURN 'CONT';
    END;
    END UTILITIES_PKG;
    when I run above query its coming in 1.2 seconds.but when comment subquery and call from package its taking 9 seconds.query returns more than 2000 records.i am not able to find the reason why it is taking more time when calling from package?

    You are getting a different plan when you run it as PL/SQL most likely. Comment your statement:
    SELECT /* your comment here */then find them in V$SQL and get the SQL IDs. You can then use DBMS_XPLAN.DISPLAY_CURSOR to see what is actually happening.
    http://www.psoug.org/reference/dbms_xplan.html

  • Java works stand alone does not when called from PL/SQL

    I have this piece of code, which works as a standalone program: It takes in the en_var and returns a path.
    But it wont work when called from a store procedure the line of code p = rt.exec("echo "+envar); returns a path as a standalone program returns null when called from a Oracle store procedure.
    Thanks for any help just going around and round in circles.
    import java.util.*;
    class translate
    public static String translatePath(String envar)
    Runtime rt = Runtime.getRuntime();
    int bufSize = 4096;
    byte buffer[] = new byte[bufSize];
    String path = null;
    Process p = null;
    String os = null;
    String name = null;
    String home = null;
    String dir = null;
    SecurityManager sm = null;
    int len = 0;
    try
    System.out.println("Calling echo "+envar);
    os = System.getProperty("os.name");
    name = System.getProperty("user.name");
    home = System.getProperty("user.home");
    dir = System.getProperty("user.dir");
    sm = System.getSecurityManager();
    p = rt.exec("echo "+envar);
    BufferedInputStream bis = new BufferedInputStream(p.getInputStream());
    while ((len = bis.read(buffer, 0, bufSize)) != -1)
    System.out.write(buffer, 0, len);
    path = new String(buffer);
    //p.waitFor();
    bis.close();
    return path;
    catch(Exception e)
    System.out.println("Exception "+e);
    return "ProcessProblem";
    //path = "/rims/live/log";

    Still cant get it to work, it doesnt fall over anymore, but when I input $PATH, it will output $PATH instead of the path for $PATH i.e /rims/live: What does your program output please:
    Here is my code:
    import java.io.*;
    import java.util.*;
    class translate
         public static String translatePath(String envar)
              Runtime rt = Runtime.getRuntime();
              Process p = null;
              String echoOutput = null;
              int len = 0;
              try
                   System.out.println("Calling echo "+envar);
                   p = rt.exec(new String[]{"/bin/echo",envar});
                   InputStreamReader isr = new InputStreamReader(p.getInputStream());
                   BufferedReader br = new BufferedReader(isr);
                   echoOutput = br.readLine();
                   br.close();
                   isr.close();
                   return echoOutput;
              catch(Exception e)
                   System.out.println("Exception "+e);
                   return "ProcessProblem";
              //path = "/rims/live/log";
    Thanks for all your help so far.
    Tony

  • SESSION EXPIRED and CPU Utilisation is 100% when called from Pro*C

    Dear Colleague
    We are having a production system developed using Pro*c and PL/SOL packages in HP Unix.
    The system is doing the following,
    A file will be decoded using Proc and data will be load into 3 temporary tables (permanent table used for temporary) using SQLLoader. Then it calls a PL/SQL package which will process the data in the temporary tables and will store the summary information in Transaction table and will returns a unique id to the calling Pro*c module. The whole process is completed in a single process/oracle session.
    The PL/SQL package, join the 3 Temporary tables and retrieve the data into an Oracle object(Collection) and process it. Then the processing summary will be loaded into Transaction table and return the Primary key.
    Now the problem is, when the temporary tables are loaded with more than 200,000 rows, in some cases the system is running for hours before it finish. And during the process the session shows as EXPIRED in the database and CPU utilization for the respective ProcessId in Unix is almost 100%. Then after a while the session comes alive and finishes the process.
    And for some other cases, with same row count, the entire process finished in seconds.
    If the same process (PL/SQL package) when run directly using a separate session inside the database(and the temporary tables are still available), rather than calling from Pro*c, it finishes in seconds, where it took hours when called from Pro*c.
    It will be highly appreciated, if anyone let me know, what actually is wrong. whether it is the resource allocation or should there any known problem in calling huge PL/SQL packages from Pro*C.
    we are using Oracle 10g and HP-UX ed42 B.11.31 U System.
    regards
    Sajid

    Dear Colleague
    I just want to rephrase the problem again.
    We have a Pro*C application. This will read the binary file and dump the data in ascii format to a data file. Then, within from the pro*C, 14 Dynamic tables will be created using EXEC SQL EXECUTE IMMEDIATE statement, each having almost a maximum of 45 columns. Also, created INDEXES to the tables in the same way from Pro*C.
    And Control file will be created as follows
    OPTIONS (SILENT=(FEEDBACK)) UNRECOVERABLE
    LOAD DATA
    INTO TABLE FILENAME_BCI_USED
    FIELDS  TERMINATED BY '|'
    TRAILING NULLCOLSColumns Listed
    Then Sql loader will be called using system commands (from pro*C itself) to loead the data into the table, as follows.
       sprintf(syscommand,"sqlldr %s CONTROL=%s DATA=%s log=%s rows=5000 direct=true", glb_connect_string,ctl_file,data_file, log_file );
       ret_value = system(syscommand);data loaded successfully.
    Then the Pro*C will call a PL/SQL package for processing the data.
    The PL/SQL package, to process the data, dynamically construct the below query and use it for the reference cursor to retrieve data and load into a collection.
    v_sql_query := 'SELECT '|| '/*+ index(b '||p_File_Name ||'_1) index(b '||p_File_Name ||'_2) index(s '||p_File_Name ||'_3) index(s '||p_File_Name ||'_4) index(s '||p_File_Name ||'_5) index(s '||p_File_Name ||'_6) index(e '||p_File_Name ||'_7)*/'   || '
             iot_call_record(b.rec_no ,
             b.rec_type ,
             substr(b.field1,1,15) ,
             nvl(substr((select s0.field1 from ' || SU_Table ||
                         ' s0 where s0.rec_no = s.rec_no and s0.sub_rec_type = 203) ,1, 25),
                                 substr(b.field2, 1, 25)),
             substr(b.field3,1,25) ,
             b.field4 ,
             b.field5 ,
             s.field1 ,
             s.field2 ,
             (select sum(s1.field1) from ' || SU_Table ||
                         ' s1 where s1.field2 = s.rec_no and trim(s1.field2) = ''00'' ) ,
             s.field3 ,
             e.field2/power(10,e.field3) ,
             s.field4 ,
             s.field5 ,
             s.field6 ,
             s.field7 ,
             s.field8 ,
             s.field9 ,
             s.field10 ,
             nvl(b.field6,''F'') ,
             NULL ,
             s.field11 ,
             (select sum(s2.field11) from ' || SU_Table || ' s2 where s2.rec_no = s.rec_no)  ,
             NULL)
          FROM   ' || BCI_Table || ' b , ' || SU_Table || ' s, ' || EXCH_Table ||
                         ' e WHERE  b.filename = s.filename
            AND    b.rec_no = s.rec_no
            AND    (b.field7 = 0 OR b.field7 = 1)
            AND    TRIM(s.chg_type) = ''00''
            AND    (s.field1 = e.field2_Code )
            AND    not(s.field4 = ''V'' and s.field12 > 1)
            AND    not(s.field4 = ''W'' and s.field12 > 1)
            AND    not(b.rec_type = 75 and s.field12 > 1)
            AND    not(b.rec_type = 75 and s.field4 =''D'')
            AND    s.sub_rec_type <> 203
            and    (s.field12 = 1 or b.rec_type not in (20,30))';
        OPEN cur_call_events FOR v_sql_query;
        LOOP
          g_tab_call_events.DELETE;
          --      Execute immediate v_sql_query bulk collect into g_tab_call_events;
          FETCH cur_call_events BULK COLLECT
            INTO g_tab_call_events limit 5000;
          EXIT WHEN g_tab_call_events.COUNT = 0;
          BEGIN
            SAVEPOINT Block_Begin;
            process_records(p_file_name,
                            g_tab_call_events);
          EXCEPTION
            WHEN Severe_Error THEN
              Write_error('S');
              ROLLBACK TO Block_Begin;
            WHEN Warning THEN
              Write_error('W');
            WHEN NO_DATA_FOUND THEN
              Write_error('S');
              ROLLBACK TO Block_Begin;
          END;
        END LOOP;And the above module is behaving strangely.
    With almost 150K or more rows in BCI_Table & SU_Table each and less than 10 rows in EXCH_Table, the application takes more than 100 minutes to complete the process.
    When we checked the session activity, it is showing the same query for a very long time.
    Where as files with 100K or less rows are getting processed in a minute.
    And the performance for 150K+ rows is inconsistent, that when we isolate the package and run it directly calling from oracle, it is getting executed in less than 4 minutes. Whereas it takes 100+ minutes from Pro*C.
    The execution plan for the above query is given below
                                  Object Owner     Object Name          Cost     Cardinality     Bytes     CPU cost     IO cost
    SELECT STATEMENT, GOAL = HINT: FIRST_ROWS                              494     2497          494406     143334576     483
    TABLE ACCESS BY INDEX ROWID               SCHEMA1          FILENAME_SU_USED     4     1          21     30610          4
      INDEX RANGE SCAN                    SCHEMA1          FILENAME_3          3     1          21764     3
    SORT AGGREGATE                                                  1     13          
      INDEX RANGE SCAN                    SCHEMA1          FILENAME_5          3     1          13     22064          3
    SORT AGGREGATE                                                  1     7          
      TABLE ACCESS BY INDEX ROWID               SCHEMA1          FILENAME_SU_USED     4     1          7     30706          4
       INDEX RANGE SCAN                    SCHEMA1          FILENAME_3          3     1          21764     3
    CONCATENATION                                   
      HASH JOIN                                                  355     2496          1307904     103068617     347
       TABLE ACCESS FULL                    SCHEMA1          FILENAME_EXCH_USED     3     2          26     35987          3
       HASH JOIN                                                  352     2496          813696     96532618     344
        VIEW                         SYS          VW_NSO_1          4     20          880     12549326     3
         HASH UNIQUE                                             4     20          220     12549326     3
          TABLE ACCESS FULL                    SCHEMA2          IOT_SERVICE_MATRIX     3     20          220     45207          3
        HASH JOIN                                                  347     15850          2234850     76145180     341
         TABLE ACCESS FULL                    SCHEMA1          FILENAME_SU_USED     130     16584          1111128     33625872     127
         TABLE ACCESS FULL                    SCHEMA1          FILENAME_BCI_USED     217     23757          1758018     31405896     214
      NESTED LOOPS                                                  139     1          198     40265959     136
       NESTED LOOPS                                                  135     1          154     27716633     133
        NESTED LOOPS                                             132     1          141     27680646     130
         TABLE ACCESS FULL                    SCHEMA1          FILENAME_SU_USED     129     1          67     27655992     127
         TABLE ACCESS BY INDEX ROWID          SCHEMA1          FILENAME_BCI_USED     3     1          74     24654          3
          INDEX RANGE SCAN                    SCHEMA1          FILENAME_1          2     1          15493     2
        TABLE ACCESS FULL                    SCHEMA1          FILENAME_EXCH_USED     3     1          13     35987          3
       VIEW                              SYS          VW_NSO_1          4     1          44     12549326     3
        SORT UNIQUE                                                  4     20          220     12549326     3
         TABLE ACCESS FULL                    SCHEMA2          IOT_SERVICE_MATRIX     3     20          220     45207          3Regards
    Sajid
    Edited by: user12039545 on Jul 11, 2010 12:05 AM
    Edited by: user12039545 on Jul 11, 2010 12:15 AM
    Edited by: user12039545 on Jul 11, 2010 12:32 AM
    Edited by: user12039545 on Jul 11, 2010 12:34 AM
    Edited by: user12039545 on Jul 11, 2010 12:37 AM

  • Stored Procedure Does Not Run Properly When Called From Portlet

    We have a simple Java portlet that calls a PL/SQL stored procedure which we wrote. The stored procedure sends a large number of emails to users in our corporation using the "utl_smtp" package. The stored procedure returns a count of the emails back to the Java portlet when it's finished. This number is displayed in the portlet.
    Our problem:
    The stored procedure functions as expected when run from a PL/SQL block in SQL*Plus, and the Java portlet calls the procedure properly when sending out a smaller number of emails (Less than 200 usually). When we get into a higher number of emails the procedure hangs when called from the portlet, but it STILL functions properly from SQL*Plus. It does not return the number of emails sent
    and the Java portlet is unable to return a SQLException. Also, we have noticed that emails are sent at a much slower pace from the stored procedure when it's called from the portlet.

    Any Ideas?

  • JTextField update problem when called from PropertyChangeEvent

    Hi,
    I'm trying to create forms that can be dynamically loaded with Class.forname(formName).
    Those forms should always inherit some methods that make it easy to pass data to
    them and receive data from them. The idea is that the data comes from a table which
    sends a hashmap (String column/JTextField-name + String Value pairs) with firePropertyChanged
    as soon as a new row is seleceted. The JTextFields in the form are marked with setName("FieldName") that has to correspond to the name of the columns of the table.
    My problem is that I can't update the fields in my form when I'm calling getRow(HashMap)
    from within propertyChangeEvent but that's necessary to keep the forms flexible.
    JTextFieldName.setText(newText) just won't work. But it works when I call getRow(HashMap)
    from the constructor. SwingWorker and threads to update the form didn't help.
    I don't need to call pack() / update() / repaint() on the JFrame, do I ??
    update() / validate() / repaint() etc. didn't work on the JTextField themselves.
    Below is the code for one of the test-forms (just a JPanel that is inserted in a frame)
    with all of it's methods. Does anybody have a solution to this problem ??
    Thanks for taking time for that !!
    Benjamin
    * testTable.java
    * Created on 15. April 2004, 16:12
    package viewcontrol.GUI;
    * @author gerbarmb
    import javax.swing.*;
    import java.awt.*;
    import java.beans.*;
    import java.util.*;
    public class testTable extends javax.swing.JPanel
              implements
                   java.awt.event.KeyListener,
                   java.beans.PropertyChangeListener {
          * public static void main(String[] argv) { testTable tt = new testTable();
          * JFrame jf = new JFrame(); jf.setContentPane(tt); jf.setVisible(true); }
         /** Creates new customizer testTable */
         public testTable() {
              initComponents();
              HashMap hm = new HashMap();
               * Only for debugging, to see that the method getRow() works when
               * called from the constructor.
               hm.put("ttext", "TEst");
               this.getRow(hm);
          * This method is called from within the constructor to initialize the form.
          * WARNING: Do NOT modify this code. The content of this method is always
          * regenerated by the FormEditor.
         private void initComponents() {//GEN-BEGIN:initComponents
              java.awt.GridBagConstraints gridBagConstraints;
              jLabel1 = new javax.swing.JLabel();
              textIn = new javax.swing.JTextField();
              jLabel2 = new javax.swing.JLabel();
              intIn = new javax.swing.JTextField();
              jLabel3 = new javax.swing.JLabel();
              numIn = new javax.swing.JTextField();
              jLabel4 = new javax.swing.JLabel();
              dateIn = new javax.swing.JTextField();
              jLabel5 = new javax.swing.JLabel();
              dateTimeIn = new javax.swing.JTextField();
              jLabel6 = new javax.swing.JLabel();
              jCheckBox1 = new javax.swing.JCheckBox();
              keepValues = new javax.swing.JCheckBox();
              jButton1 = new javax.swing.JButton();
              setLayout(new java.awt.GridBagLayout());
              jLabel1.setText("Text");
              add(jLabel1, new java.awt.GridBagConstraints());
              textIn.setName("ttext");
              textIn.setPreferredSize(new java.awt.Dimension(100, 21));
              textIn.addActionListener(new java.awt.event.ActionListener() {
                   public void actionPerformed(java.awt.event.ActionEvent evt) {
                        textInActionPerformed(evt);
              gridBagConstraints = new java.awt.GridBagConstraints();
              gridBagConstraints.gridwidth = 2;
              add(textIn, gridBagConstraints);
              jLabel2.setText("Integer");
              add(jLabel2, new java.awt.GridBagConstraints());
              intIn.setName("tint");
              intIn.setPreferredSize(new java.awt.Dimension(50, 21));
              add(intIn, new java.awt.GridBagConstraints());
              jLabel3.setText("Number");
              add(jLabel3, new java.awt.GridBagConstraints());
              numIn.setName("tnum");
              numIn.setPreferredSize(new java.awt.Dimension(50, 21));
              add(numIn, new java.awt.GridBagConstraints());
              jLabel4.setText("Date");
              gridBagConstraints = new java.awt.GridBagConstraints();
              gridBagConstraints.gridx = 0;
              gridBagConstraints.gridy = 1;
              add(jLabel4, gridBagConstraints);
              dateIn.setName("tdate");
              dateIn.setPreferredSize(new java.awt.Dimension(50, 21));
              gridBagConstraints = new java.awt.GridBagConstraints();
              gridBagConstraints.gridx = 1;
              gridBagConstraints.gridy = 1;
              add(dateIn, gridBagConstraints);
              jLabel5.setText("DateTime");
              gridBagConstraints = new java.awt.GridBagConstraints();
              gridBagConstraints.gridx = 2;
              gridBagConstraints.gridy = 1;
              add(jLabel5, gridBagConstraints);
              dateTimeIn.setName("tidate");
              dateTimeIn.setPreferredSize(new java.awt.Dimension(80, 21));
              gridBagConstraints = new java.awt.GridBagConstraints();
              gridBagConstraints.gridy = 1;
              add(dateTimeIn, gridBagConstraints);
              jLabel6.setText("Bit");
              gridBagConstraints = new java.awt.GridBagConstraints();
              gridBagConstraints.gridy = 1;
              add(jLabel6, gridBagConstraints);
              jCheckBox1.setName("tbit");
              gridBagConstraints = new java.awt.GridBagConstraints();
              gridBagConstraints.gridy = 1;
              add(jCheckBox1, gridBagConstraints);
              keepValues.setText("keep values");
              gridBagConstraints = new java.awt.GridBagConstraints();
              gridBagConstraints.gridx = 7;
              gridBagConstraints.gridy = 3;
              add(keepValues, gridBagConstraints);
              jButton1.setText("Send");
              jButton1.addActionListener(new java.awt.event.ActionListener() {
                   public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jButton1ActionPerformed(evt);
              gridBagConstraints = new java.awt.GridBagConstraints();
              gridBagConstraints.gridx = 7;
              gridBagConstraints.gridy = 2;
              add(jButton1, gridBagConstraints);
         }//GEN-END:initComponents
         private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
              sendRow();
         }//GEN-LAST:event_jButton1ActionPerformed
         private boolean sendRow() {
              java.util.HashMap hm = new java.util.HashMap();
              Component[] cs = this.getComponents();
              for (int i = 0; i < cs.length; i++) {
                   if (((Component) cs).getName() != null) {
                        if (cs[i] instanceof JCheckBox) {
                             String value = ((JCheckBox) cs[i]).isSelected() ? "1" : "0";
                             hm.put(cs[i].getName(), value);
                        } else if (cs[i] instanceof JCheckBox) {
                             hm.put(cs[i].getName(), ((JTextField) cs[i]).getText());
              } // end for
              firePropertyChange("rowChanged", null, hm);
              return true;
         private void getRow(java.util.HashMap hm) {
              //if (! this.keepValues.isSelected()) {
              Component[] cs = this.getComponents();
              for (int i = 0; i < cs.length; i++) {
                   if (cs[i].getName() != null && hm.containsKey(cs[i].getName())) {
                        Component component = cs[i];
                        String componentName = cs[i].getName();
                        String componentValue = (String) hm.get(component.getName());
                        if (cs[i] instanceof JTextField) {
                             // output for debugging
                             System.out.println("Setting " + cs[i].getName() + " = "
                                       + componentValue);
                             ((JTextField) component).setText(componentValue);
                        } else if (cs[i] instanceof JCheckBox) {
                             // output for debugging
                             System.out.println("JCheckBox found");
                             JCheckBox cb = (JCheckBox) component;
                             boolean selected = (componentValue == null ? false : (componentValue.equals("1")
                                       ? true
                                       : false));
                             ((JCheckBox) component).setSelected(selected);
              } // end for
              /* Uncomment this code snippet to retrieve the text that has been set
              for the components (that means JTextFields)
              This is just for debugging !
              Component[] cs = this.getComponents(); for (int i = 0; i < cs.length;
              i++) { if (cs[i].getName() != null) { if (cs[i] instanceof
              JTextField) { System.out.println("Value of " +cs[i].getName() + " = " +
              ((JTextField) cs[i]).getText()); } } } // end for
         private void textInActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textInActionPerformed
         }//GEN-LAST:event_textInActionPerformed
         public void keyPressed(java.awt.event.KeyEvent e) {
              if (e.getKeyCode() == java.awt.event.KeyEvent.VK_ENTER) {
                   sendRow();
         public void keyReleased(java.awt.event.KeyEvent e) {
         public void keyTyped(java.awt.event.KeyEvent e) {
         public void propertyChange(java.beans.PropertyChangeEvent evt) {
              if (evt.getPropertyName().equals("newRow")) {
                   final PropertyChangeEvent finalEvt = evt;
                   Runnable makeChanges = new Runnable () {
                        public void run() {
                             getRow((java.util.HashMap) finalEvt.getNewValue());
         // Variables declaration - do not modify//GEN-BEGIN:variables
         private javax.swing.JTextField dateIn;
         private javax.swing.JTextField dateTimeIn;
         private javax.swing.JTextField intIn;
         private javax.swing.JButton jButton1;
         private javax.swing.JCheckBox jCheckBox1;
         private javax.swing.JLabel jLabel1;
         private javax.swing.JLabel jLabel2;
         private javax.swing.JLabel jLabel3;
         private javax.swing.JLabel jLabel4;
         private javax.swing.JLabel jLabel5;
         private javax.swing.JLabel jLabel6;
         private javax.swing.JCheckBox keepValues;
         private javax.swing.JTextField numIn;
         private javax.swing.JTextField textIn;
         // End of variables declaration//GEN-END:variables

    The problem of the change in the form not being comitted is that
    I forgot SwingUtilities.invokeLater(makeChanges); in the bottom
    part in public void propertyChange(java.beans.PropertyChangeEvent evt)
    after having created a new Runnable.
    Changes to the UI often have to be comitted by SwingUtitlities.invokeLater()
    though I don't know that much about Swing yet.
    Thanks to everybody who tried to solve that problem.
    Benjamin

  • Set the default field value to transaction code field, when calling from WD

    Hi all,
    Can we pass the value in a input field of a standard transaction calling from WD application. Suppose we are calling a transaction VA03 in an external window, then how will be pass the value in the VBAK_VBELN screen field.
    Is there any way to pass the value to this transaction field. I have also tried out to set the parameter ID 'AUN' for VA03 transaction VBELN field. But it did not work for me.
    Is there any way to set the default field value to transaction code field, when calling from WD?
    Please suggest, if anyone have any idea.
    Thanks
    Sanket

    Hi,
    I am using the below code to open a standard transaction. It will help you to explain my point more easily.
    DATA: url TYPE string,
              host TYPE string,
              port TYPE string.
    *Call below method to get host and port
      cl_http_server=>if_http_server~get_location(
         IMPORTING host = host
                port = port ).
    *create URL
      CONCATENATE 'http'
      '://' host ':' port
      '/sap/bc/gui/sap/its/webgui/?sap-client=&~transaction=' 'VA03'
       INTO url.
    *get the window manager as we are opening t code in external window.
      DATA lo_window_manager TYPE REF TO if_wd_window_manager.
      DATA lo_api_component TYPE REF TO if_wd_component.
      DATA lo_window TYPE REF TO if_wd_window.
      lo_api_component = wd_comp_controller->wd_get_api( ).
      lo_window_manager = lo_api_component->get_window_manager( ).
    call the url which we created above
      lo_window_manager->create_external_window(
      EXPORTING
      url = url
      RECEIVING
      window = lo_window ).
      lo_window->open( ).
    Note*
    One more query I want to add to this thread, that is there any possibility to call a custom transaction as well?

  • Is it possible to call diff  report queries when called from form

    hello all
    I want to know if it is possible to call different report queries when called from oracle 9i form .
    i tried to use he
    SET_REPORT_OBJECT_PROPERTY(REPORT_QUERY = 'q_diff' )
    option and actualy called the report name
    but it dint seem to work !!!
    also is it possible to chng the title of the browser at runtime

    Sandeep,
    this property is used with passing Record Groups as data parameters from Forms.
    Passing the query name indicates that the values contained in the record group substitutes the result of the named query. This may work in client/server Reports, but it definitively doesn't work on teh Web because you can't pass a Record Group as a data parameter in this environment.
    Te problem with changing a Reports query is that you must meet the same number of columns and column types as they exist in the Report. I didn't spend much time with XML based runtime customization in Reports. I think that you can change the Reports query through this feature. In Forms you would create the XML file using text_io and the merge it with an existing Reports. I never did this before. So it could be that all I am saying does not work in the end. Before following this idea, you may better ask in teh Reports forum on OTN if it is possible to use the runtime customization feature to modify the Reports query.
    Fran

  • Running  BDC in 'A' mode when called from Enterprise portal

    HI All,
    I have created a RFC which contains a BDC program that update data in SAP R/3. The RFC is called from Enterprise portal. Is it possible to run the rfc in A(all screen display) mode while calling from EP. I have tried it but it gives following 2 errors on EP
       cm_no_data_received
       rfc_error_communication
    what changes i have to do so that i can run the BDC in 'A ' mode  when called from Enterprise portal

    it would not be related to EP administration issues but something to do with GUI usage. it is loggically fare enough not to give options of viewing the debug screen in as it might concern security issues inway the data could be edited at any point of time. Moreover the screens u see in R3 are ABAP but whereas in EP it is purely based on Java and the calls to SAP is done via JCO thus enabling ABAP functionalities in EP. Maybe for these technical reasons or constraints it wont be possibel to view the screen in EP eventhough u had ext.bp activated

  • How can i measure BAPI runtime which has called from JAVA

    Hi abapers
    how can i get run time for BAPI called from JAVA through JCO.
    i know that i can use SE30 from ABAP by executing from SAP.
    may be ST05 useful for me i did it but when display trace
    i am getting big list by seeing this list i am not able to find the runtime for that BAPI.
    please any one can explain
    reagdrs
    ramesh

    Hi Ramesh,
       Irrespective of whether the call is from an external system or within sap, the bapi will be executed in R/3 only.
    So, you can safely measure the runtime using se30 only.
    If it is taking more time when called from JCo , then you can be sure that the problem is not with SAP and is actually due to the JCo connectivity with R/3.
    Regards,
    Ravi

Maybe you are looking for

  • Windows brutally slow on my iMac (Bootcamp)

    Hey guys, first of all I would like to say sry, if my english isn't propper enough and lacks sometimes. I'm from germany...but anyway, here's my problem. ;-) I have an 21,5 inch iMac mid 2011 with an intel i5, 4gb memory, AMD Radeon HD 6750 512 mb an

  • How to display CPU and memory utilization from ST06 in a report

    Hi, I want to display CPU Utilization and Memory utilization and File sys details from ST06 transaction in a report. Is there any function module or any other method to do that. Please advice. Thanks, Sandeep.

  • XI 3.0 File Adapter: Converting File Content in Sender Adapter

    Hi, This is probably a basic question but does anyone have an example of the parameters used when you are using the 'Converting File Content' option on the File Adapter ? Also, where do the record sets have to be defined ? Are these data types in the

  • File stays locked even after host instance restart

    Hello All, We have a custom adapter build over File Adapter. The extra things done by the adapter are sorting and archiving of file. We have 2 BizTalk servers to receive the input files. The file extension is change to .inprogress when it is being wo

  • How field VBRP-WAVWR is updated?

    Hello experts, What logic SAP uses to update the field VBRP-WAVWR? Is it copied from VPRS condition type? What if there are more than one Cost condition (category 'G') on a Pricing procedure? Thanks for your time.