re: [personal kdb+] KDB+ & Java

Hi Paolo,

The page on code kx documents the API thoroughly:
http://code.kx.com/wiki/Cookbook/InterfacingWithJava

Below is an example of constructing an object for upsert. The data I amsending is unkeyed, if you want to send keyed,the easiest way to see theformat is by querying a keyed table bringing the data into java andviewing it in the debugger.

        // create vectors for each column
        Time t = new Time[numRecords];
        String sym = new String[numRecords];
        double price = new double[numRecords];
       
        // loop through filling the columns with data
        for(int i=0; i<trades.size(); i++) {
            t[i] = new Time(XXXX);
            sym[i] = “dummySym”;
            price[i] = R.nextDouble() * 100.0; // R = random
        }
       
        // create the table itself from the separate columns
        Object data = new Object { t, sym, price, size, stop, cond, ex };
        c.Flip tab = new c.Flip(new c.Dict(COL_NAMES, data));

        // create the command to insert the table of data into the named table.
        Object updStatement = new Object { “upsert”, “tablename”, tab };
        try {
            conn.ks(updStatement);
        } catch (IOException e) {
            System.err.println(“error sending feed to server.”);
        }

Regards
Ryan Hamilton


From : “paolo.trpnl” <tarpanelli@libero.it>
Sent : Friday, December 07, 2012 1:00 PM
To : personal-kdbplus@googlegroups.com
Subject : [personal kdb+] KDB+ & Java

Hello,
I am trying to find some example about how use java to create insert/upsert keyedtable but I can not find something interesting

Is there any one who can help me

Thanks in advance
Paolo


Submitted via Google Groups