How to load a multiple column table in the coherence of caches?

How to load a multiple column table in the coherence of caches?
I want to load a multi-column (about 20 columns) table in cache coherence. How to change the following code (spatially how to change the SQL SELECT statement)?
Is the following select statement enough: Select the key, the value of EMPLOYEES ?
public static void bulkLoad(NamedCache cache, Connection conn)
    {
    Statement s;
    ResultSet rs;
    
    try
        {
        s = conn.createStatement();
        rs = s.executeQuery("select key, value from table");
        while (rs.next())
            {
            Integer key   = new Integer(rs.getInt(1));
            String  value = rs.getString(2);
            cache.put(key, value);
            }
        ...
        }
    catch (SQLException e)
        {...}
    }

First of all, you need a class to hold your 20 fields:

public class Data {

    private String field1;
    private String field2;
    private String field3;
    private String field4;
    private String field5;
    private String field6;
    private String field7;
    private String field8;
    private String field9;
    private String field10;
    private String field11;
    private String field12;
    private String field13;
    private String field14;
    private String field15;
    private String field16;
    private String field17;
    private String field18;
    private String field19;
    private String field20;

    public Data() {
    }

    public String getField1() {
        return field1;
    }

    public void setField1(String field1) {
        this.field1 = field1;
    }

    public String getField2() {
        return field2;
    }

    public void setField2(String field2) {
        this.field2 = field2;
    }

    public String getField3() {
        return field3;
    }

    public void setField3(String field3) {
        this.field3 = field3;
    }

    public String getField4() {
        return field4;
    }

    public void setField4(String field4) {
        this.field4 = field4;
    }

    public String getField5() {
        return field5;
    }

    public void setField5(String field5) {
        this.field5 = field5;
    }

    public String getField6() {
        return field6;
    }

    public void setField6(String field6) {
        this.field6 = field6;
    }

    public String getField7() {
        return field7;
    }

    public void setField7(String field7) {
        this.field7 = field7;
    }

    public String getField8() {
        return field8;
    }

    public void setField8(String field8) {
        this.field8 = field8;
    }

    public String getField9() {
        return field9;
    }

    public void setField9(String field9) {
        this.field9 = field9;
    }

    public String getField10() {
        return field10;
    }

    public void setField10(String field10) {
        this.field10 = field10;
    }

    public String getField11() {
        return field11;
    }

    public void setField11(String field11) {
        this.field11 = field11;
    }

    public String getField12() {
        return field12;
    }

    public void setField12(String field12) {
        this.field12 = field12;
    }

    public String getField13() {
        return field13;
    }

    public void setField13(String field13) {
        this.field13 = field13;
    }

    public String getField14() {
        return field14;
    }

    public void setField14(String field14) {
        this.field14 = field14;
    }

    public String getField15() {
        return field15;
    }

    public void setField15(String field15) {
        this.field15 = field15;
    }

    public String getField16() {
        return field16;
    }

    public void setField16(String field16) {
        this.field16 = field16;
    }

    public String getField17() {
        return field17;
    }

    public void setField17(String field17) {
        this.field17 = field17;
    }

    public String getField18() {
        return field18;
    }

    public void setField18(String field18) {
        this.field18 = field18;
    }

    public String getField19() {
        return field19;
    }

    public void setField19(String field19) {
        this.field19 = field19;
    }

    public String getField20() {
        return field20;
    }

    public void setField20(String field20) {
        this.field20 = field20;
    }
}

Then you can use it to store data in you original code

public static void bulkLoad(NamedCache cache, Connection conn)
    {
    Statement s;
    ResultSet rs;

    try
        {
        s = conn.createStatement();
        String sql = "select key, value, value2, " +
                "value3, value4, value5, value6, " +
                "value7, value8, value9, value10 " +
                "value11, value12, value13, value14, " +
                "value15, value16, value17, value18, " +
                "value19, value120 from table";

        rs = s.executeQuery(sql);
        while (rs.next())
            {
            Integer key   = new Integer(rs.getInt(1));
            Data data = new Data();
            data.setField1(rs.getString(2));
            data.setField2(rs.getString(3));
            data.setField3(rs.getString(4));
            data.setField4(rs.getString(5));
            data.setField5(rs.getString(6));
            data.setField6(rs.getString(7));
            data.setField7(rs.getString(8));
            data.setField8(rs.getString(9));
            data.setField9(rs.getString(10));
            data.setField10(rs.getString(11));
            data.setField11(rs.getString(12));
            data.setField12(rs.getString(13));
            data.setField13(rs.getString(14));
            data.setField14(rs.getString(15));
            data.setField15(rs.getString(16));
            data.setField16(rs.getString(17));
            data.setField17(rs.getString(18));
            data.setField18(rs.getString(19));
            data.setField19(rs.getString(20));
            data.setField20(rs.getString(21));
            cache.put(key, data);
            }
        ...
        }
    catch (SQLException e)
        {...}
    }    

Of course your data object would need the appropriate field names and you will have no channels for all types. It must also implement equals and hashCode and ideally PortableObject.

JK

Tags: Fusion Middleware

Similar Questions

  • How do you count multiple columns of a field in a table

    How do you count multiple columns of a field in a table

    Select count (*)

    of user_tab_columns

    where table_name = 'YOUR_TABLE '.

  • How can you affect multiple windows open at the same time

    How can you affect multiple windows open at the same time

    You can not.  Only a calendar can have several windows.

  • How can I convert an existing table to the ITO

    Hello

    My Oracle version is 10.2.0.4

    Here's my my test_table structure.

    He has 1141580 rows.

    I want to convert to table index. However, there is no secondary indexes.
    How can I convert an existing table to the ITO.

    CREATE TABLE test_table (
       Column1             NUMBER        NOT NULL,
       Column2             DATE          NOT NULL,
       Column3             VARCHAR2(100) NOT NULL,
       Column4             VARCHAR2(8)   NULL,
       Column5             VARCHAR2(40)  NOT NULL,
       Column6             VARCHAR2(3)   NULL,
       Column7             NUMBER        NOT NULL,
       Column8             NUMBER        NULL,
       Column9             VARCHAR2(32)  NULL,
    )
    
    /
    
    
    
    ALTER TABLE test_table
      ADD CONSTRAINT test_table_pk2 PRIMARY KEY (
        Column1,
        Column2
      )
      USING INDEX
        STORAGE (
          INITIAL   30720 K
        )
    
    /
    
    
    ALTER TABLE test_table
      ADD CONSTRAINT test_table_cons1 FOREIGN KEY (
        Column1
      ) REFERENCES test_table2 (
        Column1
      )
    /

    Documentation Oracle say:
    Redefinition of Table online allows you to change the organization from a normal table (heap-organized) to an organized in index table and vice versa.

    For example, you might want to try.

  • How to load data from matrix report in the base using ODI table data

    Hello

    How to load matrix report data in the base table data using oracle Data Integrator?

    Description of the requirement:

    This is the data from matrix report:
    JOB                       DEPT10                DEPT20  
    ___________________________ _____________
    ANALYST                                           6000
    CLERK                   1300                     1900 
    Need to convert it to the format below:
    JOB                             Dept                        Salary
    _____________________________________________
    ANALYST                  DEPT10      
    ANALYST                  DEPT20                     6000
    CLERK                       DEPT10                    1300
    CLERK                       DEPT20                    1900
        
    Thank you for your help in advance. Let me know if any other explanation is needed.

    Your list seems to be a bit restrictive, you can do much more with the procedures of ODI.

    If you create the new procedure and add a step. In the 'source' tab command you define technology and pattern according to your source database. Use the unpivot operator as described in the link, please, instead of using "SELECT *' use the column names and aliases for example:"

    SELECT workstation,
    deptsal as deptsal,
    saldesc as saledesc
    OF pivoted_data
    UNPIVOT)
    deptsal-<-->
    FOR saldesc-<-->
    IN (d10_sal, d20_sal, d30_sal, d40_sal).<-->
    )

    Then in your tab 'command on target' defined technology and drawing on your target db, then put your INSERT statement for example:

    INSERT INTO job_sales
    (employment,
    deptsal,
    saledesc
    )
    VALUES
    (
    : job,.
    : deptsal,.
    : saledesc
    )

    That's why you use bind variables from source to load data into the target.

    Obviously if the source and target table is in the same database, you can have it all in a single statement to the "command on target' as

    INSERT INTO job_sales
    (employment,
    deptsal,
    saledesc
    )
    SELECT workstation,
    deptsal as deptsal,
    saldesc as saledesc
    OF pivoted_data
    UNPIVOT)
    deptsal-<-->
    FOR saldesc-<-->
    IN (d10_sal, d20_sal, d30_sal, d40_sal).<-->
    )

    also assign the log count "Insert" on the tab corresponding to your INSERT statement, so that you know how many rows you insert into the table.

    I hope this helps.

    BUT remember that this feature is out in Oracle 11 g.

  • How to load data from different tables, but record to another table?

    Hi all

    I use the apex and I understand how it updates and saves the files normally.

    In this case, I would need to load from a table, but save on another Board on the button "submit".

    I am aware that it would be easy as forms where I could do a manual insert process. im making in tabular form and I don't really know how to handle this process.

    Suppose that I am loading a set of questionnaires in the form of tables and have a yes / no selection.

    If the questions would come from table A and I need to save it in table B.

    in this case that I can't put just the value default by the tabular row for questions coz it would be dynamic and this example is on a small scale. I would need to load the table A and record in table B.

    could someone guide me on this operation or provide tutorials any?

    Maybe that's what you're after.

    (1) create region report using SQL like this:

    Select apex_item.hidden(1,rownum).

    apex_item.display_and_save(2,question_column) in Question,

    apex_item. Text(3,,4,4) as answer

    from table_a

    apex_item documentation of package found:

    http://docs.Oracle.com/CD/E37097_01/doc/doc.42/e35127/apex_item.htm

    The pidx (first number) in each apex_item parameter is used to identify this item in the same row of the report' / tabular form.

    (2) create a submit in procedure a bit like that.

    Start

    because I 1.apex_application.g_f01.count loop - identifies the "apex_item.hidden(1,rownum)" at the top and gets a count of how many times it occurs

    Insert into table_b (question, answer)

    values (apex_application.g_f02 (i), apex_application.g_f03 (i));

    end loop;

    end;

  • How to load several files DBF table 1 target using only 1 interface?

    Hello, I am a beginner in ODI and I have a problem.

    I have several DBF / Foxpro files that is stored in a directory like this:
    2010_10/account.dbf
    2010_11/account.dbf

    All DBF files have the same structure, but stored in a different folder (the folder name is < year > _ < month >)

    I managed to create an interface to load a DBF unique for the target table and the source table is hardcoded in the interface. Ideally, the interface will take place once a month.

    How can I use the same interface to load other DBF files?

    I know, if the data source is a text file, you can link the resource name to a variable, and the variable can be set to a file name. But I can't do since I use a JDBC driver to connect to the DBF file.

    Any help will be appreciated

    Hello

    I have no idea on the DBF files, yet...

    What is create a variable to build the 'months' and then pass this variable to OdiFileCopy, move this file to a specific directory. Then run your interface to load this file into your database. Once the work is successful, you can delete the file using OdiFileDelete (optional)

    Thank you
    Fati

  • How dynamically load data in target tables using as source files

    Hello

    My script needs a single interface to load data from 5 different files in five paintings of target using a single interface. All target tables have the same structure. It is possible to point to files variable source using ODI. But the same approach does not work with database tables. I get errors trying to make my table as dynamic target/source.

    Can anyone suggest anything. The last option would write a dynamic PL/SQL block in the KM. Other friends of suggestions?

    Kind regards
    Jay

    and not exists)
    Select 'X '.
    h. #PLAYGROUND. "v_tab_name"T ".

    have you provided the name of the resource with the quotes, if so please remove it and try.

    If you have provided the name of the variable, a v_tab_name and do not provide quotes. Can you please change the name of the variable to the capital, namely V_TAB_NAME and use the same in the data store too and please try again.

  • How to load data from ms sql to the by the file rules and maxl essbase

    Hi, everybody!
    Pretty Shure the kind of topic exists already on the forum, but unfortunately can't find it.

    I want to understand, how to load data from the database to ms sql for the PB of essbase application.

    (I) so I have:
    1. a request for 'society '.
    2 and its database 'Plan '.
    3. with simple outline, which contains only two dimensions:

    -The time period < 1 > (Label only)
    -Total year (~)
    -Qtr1 (+)
    Jan (+)
    Feb (+)
    Mar (+)
    -Qtr2 (+)
    APR (+)
    May (+)
    Jun (+)

    -Accounts < 1 > (Label only)
    -Lost / based (~) (Label only)
    -Revenues (+)
    L1.1 (+)
    L1.2 (+)
    -Costs (-)
    L2.1 (+)
    L2.2 (+)

    (II) also, I created a rules file called "CO_DWH" and associated with this schema
    It (Rules file) a 3 columns:
    Data of the 'period', 'account '.

    There is also the option checked "load data".

    (III) in MS SQL Server, I have a database of "hypdb" and "essadmin" with "password" login

    (IV) I executed my bat file:
    C:\Hyperion\EssLoad.bat
    There is only one line:

    EssLoad.bat-
    startMaxl.cmd EssLoad.txt
    ----------------------------------------------

    EssLoad.txt-
    login password admin on erpserver;
    Import database data Company.Plan connect in essadmin password using the server rules_file 'CO_DWH' error abort;
    disconnection;
    "exit";
    --------------------------------------------


    All plans that I copied well worked ERP system, but I don't understand, this is exactly table in the MS SQL database, data loading to essbase db?

    TOU have to do a few things
    1. on the server of Essbase, put in place a system odbc for your MySQL database connection
    2. in the State of charge, go to the file menu and select open source SQL database and in the source of data in your SQL statement. A few tips. Where it says select, don't put in the select Word and when he says to not put in of. The system adds for you. TI enter a simple SQL statement is to do this in the box so select if your SQL would be normanlly as select * from myTable just enter the code as * from myTable in the upscale neighborhood

    The ol/recover the click and fill your connection information. Should bring back the data in the State of charge. Save the State of charge and use

  • How can I connect 2D Boolean table at the entrance to the structure of the case?

    Hello

    I would like to know how to solve this problem. I try to connect the output of a digital 2D painting and a constant number of 'BIG' before you connect it to the entrance of the structure of the case. An error message appears and it shows ' the type of the source is a 2D boolean array. The sink type is Boolean "."

    I tried to 'disable indexing' on the box of the structure of the case, but the error remains. Would appreciate any comments on it.

    Entry 0 third entry in the index table, not the other.

  • How to load and you unsubscribe contacts of the group e-mail to the E10?

    I know how to load new contacts and worldwide unsubscribe them but I'm trying to figure out how to unsubscribe them only to the Group an email because we have several brands. Someone knows how to do this in E10? Thank you

    Hi Rebecca

    One way I've seen to do would be to put everyone in a list shared during the download.

    Then, build a small program that has a stage for them to unsubscribe from the campaign. Add the list shared in the program and this will be done.

  • JAX - WS: how to choose among multiple client certificates on the fly?

    I have a webapp that calls a web service provided by a supplier. The seller requires the use of client certificates for authentication, and with success, I called their service using the keystore PKCS #12 they gave us with JAX - WS 2.2 using code like this:
        System.setProperty("javax.net.ssl.keyStore", "myKeyStore.p12");<br />
        System.setProperty("javax.net.ssl.keyStoreType", "pkcs12");<br />
        System.setProperty("javax.net.ssl.keyStorePassword", "password");
    The problem is, my webapp will support multiple profit centers, and the seller makes a distinction between our business units by issuing separate certificates for each. So I'm faced with a dilemma: I have four PKCS #12 files, one per unit of my webapp, and business will have to decide which one to use when running. In addition, this webapp could be highly used by many concurrent users, and therefore more than one of the CERT can should be used at the same time. So whatever the solution is, it must be thread-safe.

    I was able to combine all four certificates in a single key JKS file using the JDK 1.6 operation "keytool - importkeystore ' with each of my four certificates PKCS #12, so I have now all four in a single JKS keystore. The above code would be this:
        System.setProperty("javax.net.ssl.keyStore", "myKeyStore.jks");<br />
        System.setProperty("javax.net.ssl.keyStoreType", "jks");<br />
        System.setProperty("javax.net.ssl.keyStorePassword", "password");
    So my challenge now is to select between the four possible certs program during the call to the provider's web service. How do I with JAX - WS RI 2.2?

    Thank you
    Bill

    1.6 I think you can set a default value for custom SSLContext. So you do that and equip with a customized KeyManager you can control outside to ask what keystore alias to use.

  • How could I avoid creating C$ table in the db (readonly) source?

    Hi all, I have a big problem here, hope you can help me :(

    the source DB: ORACLE, SQLSERVER2005
    target db: ORACLE
    For oracle data to oracle, I use 'LKM to Oracle (Oracle DBLINK)', 'IKM Oracle incremental update' and 'CKM Oracle. "
    Of data between SQL SERVER and oracle, I use 'LKM SQL for Oracle', 'IKM Oracle incremental update' and 'CKM Oracle. "

    Today, my boss told me that I should not create or alter any table in the source database, even if it was table C$ created by ODI.
    What can I do? Which KM in each progress (ELT) should I use to deal with this situation?

    Hi Jun,

    U cannot use DBLINK and datapump in this case. Try SQL for SQL or SQL for Oracle LKM.

    Thank you
    Guru

  • How to load several files column data into essbase using the rule of load.

    Hello

    I need to load a file of data into essbase, which includes data from several columns.

    Here is a sample file.


    Year, Department, account, Jan, Feb, Mar, Apr, may, June, July, August, Sept, Oct, Nov, Dec
    FY10, ministere1, account1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
    FY10, agencies2, account1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
    FY10, ministere3, account1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12


    Thank you
    Sirot

    But this isn't an error as such, that is to say that no data values have been changed so that they possible already exist in the database.
    If there is no release, they should be in a file of errors.

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • How to load data from Oracle tables into essbase?


    Hello

    I'm fairly new to essbase. We are working on essbase 11.1.2.2.

    I want to build size & load data using pre-existing data warehouse which is built on Oracle.

    I try to use "Open SQL". I use OIC.  It is gicing me connection error (1021001).

    The following log shows:

    [Sea 14 Aug 14:15:06 2013] Local/SA_EB_1/MIS_FIN/SA0053580@Native Directory/10868/Info (1021097)
    EssOCI Initializes the connection to the Oracle database on the server [tmdwtst1]

    [Sea 14 Aug 14:15:25 2013] Local/SA_EB_1/MIS_FIN/SA0053580@Native Directory/10868/Info (1021099)
    EssOCI could not connect to the Oracle database with error message [ORA-12154: TNS: could not resolve the connect identifier specified]
    ]

    [Sea 14 Aug 14:15:25 2013] Local/SA_EB_1/MIS_FIN/SA0053580@Native Directory/10868/Error (1021001)
    Cannot establish a connection to the SQL database server.  See the log for more information

    [Sea 14 Aug 14:15:25 2013] Local/SA_EB_1/MIS_FIN/SA0053580@Native Directory/10868/Warning (1080014)
    Transaction [0 x 2650001 (0x520b4392.0x69b68)] abandoned due to the State [1021001].

    Help, please.

    Thank you

    Sam

    You use the correct format for the OIC:

    Host: port / Oracle_service_name

    See you soon

    John

    http://John-Goodwin.blogspot.com/

Maybe you are looking for