Parsing input stream into named value pairs

Hi everyone. I figured I would post this scenario, and hope to get some 'expert' opinions on what the best way to handle this would be.
I have an input stream being returned to me and I need to separate them into name/value pairs. I receive this as two lines of strings. The first line is the variable names, and the second line is the values. This is the format:
"Variable1","Variable2","Variable3","Variable4"
"Value1","Value2","Value3","Value4"
I need to separate this out into:
Variable1 = "Value1"
Variable2 = "Value2"
What I was thinking of doing is to create a hashtable, read the first line in and assign those as the keys, then read the second line in and assign those as the values. I'm not quite sure if this is even possible as of yet, but thats my original game plan. My primary goals are:
1. Seperate each variable name and match it with its appropriate value
2. Be able to retrieve each value by calling the appropriate variable name.
Any advice/opinion on this is greatly appreciated!!! Thanks!

You could choose to feed the String through an InputStream and use a StreamTokenizer, which is substantially more powerful than StringTokenizer. I would personally, however, choose to parse it myself, as antequated as that might seem. ;)
Presume that s1 is equal to
"Var1", "Var2", "MoreVars", "EvenMoreVars" , "LastVar"
And that s2 is equal to
"Hello","9900", ":)", "He said \"hi\".", "Hi, there."
These would make good sample data, but aren't necessarily the case.
String s1 = ...;
String s2 = ...;
HashMap map = null;
String[] keys = parseQuotedByCommas(s1);
String[] values = parseQuotedByCommas(s2);
if (keys.length==values.length)
    map = new HashMap();
    for (int i=0;i<keys.length;i++)
        map.put(keys, values[i]);
} else
// Error!
// throws IllegalArgumentException for improperly formatted strings
public static String[] parseQuotedByCommas(String s)
     ArrayList acc = new ArrayList();
     char[] ch = s.toCharArray();
     int i = 0;
     try
          while (i < ch.length)
               while (ch[i] == ' ') i++;
               if (i < ch.length)
                    if (ch[i] != '"')
                         throw new IllegalArgumentException(
                         "Expected '\"', receieved '" + ch[i] + "'");
                    i++;
                    StringBuffer sb = new StringBuffer();
                    boolean stop = false;
                    while (!stop)
                         switch (ch[i])
                              case '"':
                                   if (ch[i - 1] == '\\')
                                        sb.append('"');
                                   else
                                        stop = true;
                                   break;
                              case '\\':
                                   int j = i;
                                   boolean write = true;
                                   while ((j >= 0) && (ch[j] == '\\'))
                                        write = !write;
                                        j--;
                                   if (write) sb.append('\\');
                                   break;
                              default:
                                   sb.append(ch[i]);
                         i++;
                    acc.add(sb.toString());
               if (i < ch.length)
                    while (ch[i] == ' ') i++;
                    if (i < ch.length)
                         if ((ch[i] != ',') && (ch[i] != '"'))
                              throw new IllegalArgumentException(
                              "Expected ',' or '\"', received '" + ch[i] + "'");
                         i++;
     } catch (IndexOutOfBoundsException oob)
          throw new IllegalArgumentException("Unexpected end of string.");
     return (String[]) (acc.toArray(new String[0]));
That should work for anything formatted as
<String> ::= [<WhiteSpace>] <Stmt> [ [<WhiteSpace>] , [<WhiteSpace>] <Stmt> ] *
<Stmt> ::= " <Characters> "
<Characters> ::= \" | \\ | <AnyCharacterExceptQuoteOrBackslash>
<WhiteSpace> ::= <Space>*
Any questions?
Oh, BTW, that was all blue 'cause the code tag doesn't take well to '"'.

Similar Messages

  • Parsing an xml string into id-value pair format

    Hi,
    I am new in oracle BPEL.
    My requirement is that I need to parse an xml string containing tag name and coressponding value into an 'id -value' pair.
    For example-
    The input xml format is -
    <employee>
    <empid>12345</empid>
    <name>xyz</name>
    <city>London</city>
    </employee>
    The required xml format is-
    <employee>
    <item id="empid" value="12345"/>
    <item id="name" value="xyz"/>
    <item id="city" value="London"/>
    </employee>
    Please let me know if there is a work-around for this.
    Thanks

    Something like this (have not tested):
    <xsl:for-each select="//employee">
    <employee>
    <xsl:for-each select="./*">
    <item>
    <xsl:attribute name="id">
    <xsl:value-of select="name()"/>
    </xsl:attribute>
    <xsl:attribute name="value">
    <xsl:value-of select="text()"/>
    </xsl:attribute>
    </item>
    </xsl:for-each>
    </employee>
    </xsl:for-each>

  • Parsing input stream from a socket

    Hi, i must read a byte stream from a socket. My problem is that i cannot determine when a stream ends because there are no terminator characters. I tried to use the read() method of BufferedReader class but it blocks when server statement ends. Is there a way to read the stream and answer to the server?
    Thanks,
    Andrea

    andmus wrote:
    Hi, i must read a byte stream from a socket. My problem is that i cannot determine when a stream ends because there are no terminator characters. I tried to use the read() method of BufferedReader class but it blocks when server statement ends. Is there a way to read the stream and answer to the server?
    If you're reading HTTP...
    Unless the request has been sent with Connection: close, it's normal that your read blocks, since the connection is purposefully left open to accomodate further exchanges.
    You'll have to parse the data to know when each message is complete. The first empty line (bytes: \r\n\r\n ASCII) denotes the end of the header. The header will have a Content-Length property which tells you how many bytes are left to read.
    Google the HTTP specs if you don't know them.

  • Control a 3 phase motor and convert input voltages into pressure values.

    Hi,
    I'm in my 4th year at university and I have been given a project that involves the experimental investigation of the interaction between fishing gears and the seabed. The work will consist dragging full-size or scale trawl components along a channel containing typical seabed sediments. I aim to create a LabView program that will allow me to operate the motor and analyze the 6 transducers I will be using.
    For the motor I desire to be able to:
    1 - Start the motor.
    2 - Define the speed it accelerates to.
    3 - Have the ability to switch off automatically depending on its speed and distance it has to the end of the rig to avoid the trolley crashing.
    For the 6 transducers (4 pressures, 1 load cell, 1 horizontal displacement) I desire to be able to:
    1 - Convert the voltage signal into the relevant unit of measurement.
    2 - Record data at a rate of 10Hz.
    3 - Output the recorded data into a file and also onto graphs.
    I also intend to introduce an emergency shut down facility for the whole system.
    I have started doing the built-in tutorials so i am able to do the basic routines. However I have no idea where to start creating a program to control a 3 phase motor and to be able t convert voltages from transducers into pessures and distances.
    I have version 8.5 if anyone has any information or advice i would greatly appreciate it .
    Thanks,
    Grant.
    Message Edited by grantstephen on 03-14-2008 11:28 AM

    You should try in the LabVIEW forum.  This forum is for Employers with LabVIEW job openings.
    http://forums.ni.com/ni/board?board.id=170
    =============
    XP SP2, LV 8.2
    CLAD

  • HTTP adapter as receiver to POST name-value pairs - How to?

    Hi,
    Scenario: HTTP Sender <> XI <> HTTP receiver (Sync throughout; no BPM)
    In this scenario, a HTTP channel is configured to the target URL to post data.
    The message mapping results in a XML. HTTP posts the same XML to the target URL.
    However,the target URL expects data Posted as name-value pairs.
    eg. eid=45678&zip=11011&ename=Tom%20Lee
    How can we configure HTTP adapter channel to post XML data as
    name-value pairs (as in standard HTTP Form Post)?
    Any pointers?
    thanx,
    Pops

    Hi Udo,
    I currently have a solution (simpler than having a BP), but do not expect it to be the right way of doing.
    I am using Java Mapping to convert the XML structure into Name-Value pair. So the output of Mapping is a string like how HTTP post is expected. So the interface mapping having multiple mappings - firstly, the original Message mapping, and then the Java mapping to do the conversion. So, with a small extension, the solution is still kept simple.
    However, I thought the POST requirement to HTTP URLs would be a common requirement, and expected the HTTP adapter doing this conversion. So, I am still looking for a straight solution (without any custom extensions).
    Any one else faced this situation?
    Can't this be handled by HTTP Adapter?
    -- Pops V

  • Problem reading input stream of urlconnection within portal

    Hi,
    This may be a generic server issue rather than portal but since it's my portal app that's displaying the problem I'll post it here.
    Part of my Portal attempts to POST to a remote server to retrieve some search results.
    In environments A & B (both standalone instances) this works fine.
    In environment C this works on the managed instances in the cluster but not the admin instance.
    In environment D (again standalone) it fails, but if I add a managed instance it works from the managed instance.
    The problem I'm seeing is that I get a stuck thread and the thread dump shows it is blocked attempting to read the resulting input from a urlconnection. (Using a buffered input stream).
    I've copied the code to a standalone class that runs fine from the same server(s). I've pasted this code below, the contents of the test() method were copied directly from my webapp (urls changed here for clarity).
    Does anyone know of any securitymanager issues that may cause this?
    Or anything else for that matter?
    Code sample:
    package src.samples;
    import java.io.BufferedReader;
    import java.io.DataOutputStream;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.URLConnection;
    public class POSTTest {
         public static boolean test()
         URL url = null;
         try {
         url = new URL
    ("http://hostx:80/myapp/search.html");
         catch (MalformedURLException e)
         e.printStackTrace();
         return false;
         URLConnection urlConn;
         DataOutputStream printout;
         BufferedReader input;
         urlConn = null;
         try {
         urlConn = url.openConnection();
         catch (IOException e)
         e.printStackTrace();
         return false;
         // Let the run-time system (RTS) know that we want input.
         urlConn.setDoInput (true);
         // Let the RTS know that we want to do output.
         urlConn.setDoOutput (true);
         // No caching, we want the real thing.
         urlConn.setUseCaches (false);
         // Specify the content type.
         urlConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
         // Send POST output (this is a POST because we write then read as per the JDK Javadoc)
         printout = null;
         String body = "";
         try {
         System.out.println("url=" + url.toString());
         printout = new DataOutputStream (urlConn.getOutputStream ());
         String content = "param1=A&param2=B&param3=C&param4=D&param5=E";
         System.out.println("urlParams= " + content);
         printout.writeBytes (content);
         System.out.println("written parameters");
         printout.flush ();
         System.out.println("flushed parameters");
         printout.close ();
         System.out.println("closed parameter stream");
         // <b>Get response data - this is where it blocks indefinitely</b>
         input = new BufferedReader(new InputStreamReader(urlConn.getInputStream()));
         System.out.println("got input");
         String str;
         while (null != ((str = input.readLine()))) {
         body = body + str + "\n";
         System.out.println("read input:");
         System.out.println(body);
         input.close ();
         System.out.println("closed input stream");
         catch (IOException e) {
         System.out.println("IOException caught: read failed");
         e.printStackTrace();
         return false;
         return true;
         * @param args
         public static void main(String[] args) {
              System.out.println("Test result= " + test());

    In your recuperar() method, read the FTP input stream into a byte array. (You can do that by copying it to a ByteArrayOutputStream and then getting the byte array from that object.) Then, return a ByteArrayInputStream based on those bytes. After you call completePendingCommand(), of course.
    That's one way.
    PC&#178;

  • Set the max bytes per packet for an input stream

    Hi,
    I got this problem:
    I want to store some images into a DB. Now if the images are huge, the DB told me, that the packet size is too large
    maybe like that : 'Packet for query is too large (1668641 > 1048576)'
    I use an ByteArrayInputStream for the transmission to the DB.
    So if I am not able to set the max. packet size of the DB is it possible to cut the input stream into pieces to send them to the DB ?
    regards,
    Olek

    None of this makes any sense.
    The MySQL driver will be using TCP to talk to the database server. TCP is a stream oriented protocol. You can't control the size of the packets (other than the maximum by frigging with OS settings - don't do that). Neither can the server detect the sizes of incoming packets. It just sees a stream of bytes and has no idea where the write() boundries are or how the TCP protocol split that into IP packets - it's just a stream of bytes arriving in the same order they were sent.
    And... the max TCP segment size is nowhere near 32Mb, so that doesn't make any sense eeither.
    So, I conclude (especially in light of the answer about the config settings) that "packet" is a badly abused term by MySQL that allows it to limit the size of individual requests in order to provide some kind of protection against badly written clients and/or malicious attacks. If you need to send more data than this, just up the limit - especially if this is an intranet application where the client is under your control and attacks are unlikely.

  • Effective way to parse key-value pair.

    Hi,
    I've a PL/SQL process, in which I've lot of dynamic sql routines planned, to parse input data to a procedure.
    One of the parameter to call or that'd be passed to this procedure is a "key-value pair"
    e.g.
    procedure p ( id in number, state_name in varchar2 )
    Values could be
    20, 'vc1=AZ, vc2=WA, vc3=NY, vc4=NJ'
    My requirement is as follows
    <ol><li>Parse 'state_name', for values of state ( AZ, WA, NY, NJ ) - note that the list could be of variable length</li>
    <li>I'm not interested in 'key' per se ( vc1, vc2, vc3... )</li>
    <li>State names are important as ( as ) part of the process, I want to concatenate them to form tables-name,
         which (already) exists e.g. table_CA, table_AZ, table_WA, table_NJ - so basically I need to
         parse these names and have them in a way to be able to use them as part of other dynamic SQL's.
    </li>
    </ol>
    Please advice.
    Thanks.

    shankariyer wrote:
    Is it possible for me to populate the output of this regex_replace into an array of varchar2 ??
    Sure:
    CREATE OR REPLACE
      TYPE STATE_TBL_TYPE
        AS
          TABLE OF VARCHAR2(2);
    SET SERVEROUTPUT ON
    DECLARE
        v_value_pair VARCHAR2(30) := 'vc1=AZ, vc2=WA, vc3=NY, vc4=NJ';
        v_state_tbl  STATE_TBL_TYPE := STATE_TBL_TYPE();
    BEGIN
        FOR v_i IN 1..NVL(LENGTH(v_value_pair) - LENGTH(REPLACE(v_value_pair,',')) + 1,0) LOOP
          v_state_tbl.EXTEND;
          v_state_tbl(v_i) := LTRIM(REGEXP_SUBSTR(v_value_pair,'=[A-Z]+',1,v_i),'=');
        END LOOP;
        FOR v_i IN 1..v_state_tbl.COUNT LOOP
          DBMS_OUTPUT.PUT_LINE(v_state_tbl(v_i));
        END LOOP;
    END;
    SQL> SET SERVEROUTPUT ON
    SQL> DECLARE
      2      v_value_pair VARCHAR2(30) := 'vc1=AZ, vc2=WA, vc3=NY, vc4=NJ';
      3      v_state_tbl  STATE_TBL_TYPE := STATE_TBL_TYPE();
      4  BEGIN
      5      FOR v_i IN 1..NVL(LENGTH(v_value_pair) - LENGTH(REPLACE(v_value_pair,',')) + 1,0) LOOP
      6        v_state_tbl.EXTEND;
      7        v_state_tbl(v_i) := LTRIM(REGEXP_SUBSTR(v_value_pair,'=[A-Z]+',1,v_i),'=');
      8      END LOOP;
      9      FOR v_i IN 1..v_state_tbl.COUNT LOOP
    10        DBMS_OUTPUT.PUT_LINE(v_state_tbl(v_i));
    11      END LOOP;
    12  END;
    13  /
    AZ
    WA
    NY
    NJ
    PL/SQL procedure successfully completed.
    SQL> SY.

  • How to combine large number of key-value pair tables into a single table?

    I have 250+ key-value pair tables with the following characteristics
    1) keys are unique within a table but may or may not be unique across tables
    2) each table has about 2 million rows
    What is the best way to create a single table with all the unique key-values from all these tables? The following two queries work till about 150+ tables
    with
      t1 as ( select 1 as key, 'a1' as val from dual union all
              select 2 as key, 'a1' as val from dual union all
              select 3 as key, 'a2' as val from dual )
    , t2 as ( select 2 as key, 'b1' as val from dual union all
              select 3 as key, 'b2' as val from dual union all
              select 4 as key, 'b3' as val from dual )
    , t3 as ( select 1 as key, 'c1' as val from dual union all
              select 3 as key, 'c1' as val from dual union all
              select 5 as key, 'c2' as val from dual )
    select coalesce(t1.key, t2.key, t3.key) as key
    ,      max(t1.val) as val1
    ,      max(t2.val) as val2
    ,      max(t3.val) as val3
    from t1
    full join t2 on ( t1.key = t2.key )
    full join t3 on ( t2.key = t3.key )
    group by coalesce(t1.key, t2.key, t3.key)
    with
      master as ( select rownum as key from dual connect by level <= 5 )
    , t1 as ( select 1 as key, 'a1' as val from dual union all
              select 2 as key, 'a1' as val from dual union all
              select 3 as key, 'a2' as val from dual )
    , t2 as ( select 2 as key, 'b1' as val from dual union all
              select 3 as key, 'b2' as val from dual union all
              select 4 as key, 'b3' as val from dual )
    , t3 as ( select 1 as key, 'c1' as val from dual union all
              select 3 as key, 'c1' as val from dual union all
              select 5 as key, 'c2' as val from dual )
    select m.key as key
    ,      t1.val as val1
    ,      t2.val as val2
    ,      t3.val as val3
    from master m
    left join t1 on ( t1.key = m.key )
    left join t2 on ( t2.key = m.key )
    left join t3 on ( t3.key = m.key )
    /

    A couple of questions, then a possible solution.
    Why on earth do you have 250+ key-value pair tables?
    Why on earth do you want to consolodate them into one table with one row per key?
    You could do a pivot of all of the tables, without joining. something like:
    with
      t1 as ( select 1 as key, 'a1' as val from dual union all
              select 2 as key, 'a1' as val from dual union all
              select 3 as key, 'a2' as val from dual )
    , t2 as ( select 2 as key, 'b1' as val from dual union all
              select 3 as key, 'b2' as val from dual union all
              select 4 as key, 'b3' as val from dual )
    , t3 as ( select 1 as key, 'c1' as val from dual union all
              select 3 as key, 'c1' as val from dual union all
              select 5 as key, 'c2' as val from dual )
    select key, max(t1val), max(t2val), max(t3val)
    FROM (select key, val t1val, null t2val, null t3val
          from t1
          union all
          select key, null, val, null
          from t2
          union all
          select key, null, null, val
          from t3)
    group by keyIf you can do this in a single query, unioning all 250+ tables, then you do not need to worry about chaining or migration. It might be necessary to do it in a couple of passes, depending on the resources available on your server. If so, I would be inclined to create the table first, with a larger than normal percent free, then do the first set as a straight insert, and the remaining pass or passes as a merge.
    Another alternative might be to use the approach above, but limit the range of keys in each pass. So pass one would have a predicate like where key between 1 and 10 in each branch of the union, pass 2 would have key between 11 and 20 etc. That way everything would be straight inserts.
    Having said all that, I go back to my second question above, why on earth do you want/need to do this? What is the business requirement you are trying to solve. There might be a much better way to meet the requirement.
    John

  • Parse XML input stream (no .xml file)?

    i have a java applet calling a web service that returns XML data as an input stream (char by char from SOAP) to this applet. if i append a all the chars to a string, is there some XML tool that will parse the string as if it were an XML document (like a getElement functions)?
    the applet cannot write the data to a .xml file, and i don't want to mess around with .jarsigning. any ideas?
    thanks,
    jonathan

    The XML parsers you are likely to be using support receiving input from a variety of sources besides files. For example you could parse XML from a String variable by passing a StringReader wrapping that String to the parser. Check the documentation for more details.

  • How to parse XML Column and insert values into a table

    Hello,
    I am working on a simple project to demonstrate how to load and extract XML using SQL, I have already made a table that contains a column of XMLTYPE and loaded an XML file into it (code below)
    create or replace directory XMLSRC as 'C:\XMLSRC';
    drop table Inventory;
    create table Inventory(Inv XMLTYPE);
    INSERT INTO Inventory VALUES (XMLTYPE(bfilename('XMLSRC', 'Inventory.xml'),nls_charset_id('AL32UTF')));
    select * from Inventory;
    I now however need to get the XML data back out of that and loaded into a new table. Troubleshooting guides I have read online seem to only be dealing with parsing an external XML document and loading it into a table, and not what I need to do which is parse a column of XML data and load that into a table. The project trivial with simple tables containing only 3 columns.
    The table that needs to be loaded is as follows:
    create table InventoryOut(PartNumber Number(10), QTY Number(10), WhLocation varchar2(500));
    The XML document is as follows:
    <?xml version="1.0" encoding="UTF-8"?>
    <dataroot xmlns:od="urn:schemas-microsoft-com:officedata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Inventory.xsd" generated="2012-04-09T17:36:30">
    <Inventory>
    <PartNumber>101</PartNumber>
    <QTY>12</QTY>
    <WhLocation>WA</WhLocation>
    </Inventory>
    </dataroot>
    Thank you for any help you can offer.

    First of all, thank you for your help!! Still stunned that you actually took the time to write out an eample using my tables/names/etc. Thank you!!
    Attached is the code, there seems to be an issue with referencing the other table, Inventory.Inv, I checked and that table and the Inv column are showing up in the database so I am not sure why it is having issues locating them, take a look at the code I wrote as well as the output (*I included the real version number for you this time :)
    EDIT: In your code right here:
    select xt.*
    3 from Inventory inve,
    4 XMLTable('/dataroot/Inventory'
    5 PASSING inve.Inv
    I think is where I am messing it up, perhaps not understanding fully what is going on, as you write "Inventory inve" and "inve.Inv" ---- Is inve a keyword that I am just not familiar with? I think this is where the issues lies in my code.
    END EDIT
    EDIT2: Well that looks like it was it, changed that to how you have it and it now works!!! Could you please explain what that few lines is doing, and what the xt.* and inve are doing? Thanks again!!!
    END EDIT2
    drop table InventoryOut;
    create table InventoryOut (PartNumber number(10), QTY number(10), WhLocation varchar2(500));
    insert into InventoryOut (PartNumber, QTY, WhLocation)
    select xt.*
    from Inventory Inv,
    XMLTable('/dataroot/Inventory'
    PASSING Inventory.Inv COLUMNS
    PartNumber number path 'PartNumber',
    QTY number path 'QTY',
    WhLocation path 'WhLocation')xt;
    select * from InventoryOut;
    select * from v$version;
    table INVENTORYOUT dropped.
    table INVENTORYOUT created.
    Error starting at line 4 in command:
    insert into InventoryOut (PartNumber, QTY, WhLocation)
    select xt.*
    from Inventory Inv,
    XMLTable('/dataroot/Inventory'
    PASSING Inventory.Inv COLUMNS
    PartNumber number path 'PartNumber',
    QTY number path 'QTY',
    WhLocation path 'WhLocation')xt
    Error at Command Line:8 Column:12
    Error report:
    SQL Error: ORA-00904: "INVENTORY"."INV": invalid identifier
    00904. 00000 - "%s: invalid identifier"
    *Cause:   
    *Action:
    PARTNUMBER QTY WHLOCATION
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE     11.2.0.1.0     Production
    TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    If this helps here is the code and output for the creation of the Inventory table itself:
    create or replace directory XMLSRC as 'C:\XMLSRC';
    drop table Inventory;
    create table Inventory(Inv XMLTYPE);
    INSERT INTO Inventory VALUES (XMLTYPE(bfilename('XMLSRC', 'Inventory.xml'),nls_charset_id('AL32UTF')));
    select * from Inventory;
    directory XMLSRC created.
    table INVENTORY dropped.
    table INVENTORY created.
    1 rows inserted.
    INV
    <?xml version="1.0" encoding="WINDOWS-1252"?>
    <dataroot xmlns:od="urn:schemas-microsoft-com:officedata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Inventory.xsd" generated="2012-04-09T17:36:30">
    <Inventory>
    <PartNumber>101</PartNumber>
    <QTY>12</QTY>
    <WhLocation>WA</WhLocation>
    </Inventory>
    </dataroot>
    Thanks again for your help so far! Hope we can get this working :)
    Edited by: 926502 on Apr 11, 2012 2:47 PM
    Edited by: 926502 on Apr 11, 2012 2:49 PM
    Edited by: 926502 on Apr 11, 2012 2:54 PM
    Edited by: 926502 on Apr 11, 2012 2:54 PM
    Updated issue to solved - Edited by: 926502 on Apr 11, 2012 2:55 PM

  • Java Install,  Cannot insert a key value pair into the secure store fails,

    Dear All,
    I'm doing Java Intallaion in BI7 on CI and in the midle of installtions we encounter,
    TRACE      [iaxxejsexp.cpp:199]
               EJS_Installer::writeTraceToLogBook()
    NWException thrown: nw.secureStore.cannotInsertIntoSecureStore:
    Cannot insert a key value pair into the secure store fails; see output of log file SecureStoreInsert.log:
    SAP Secure Store in the File System - Copyright (c) 2003 SAP AG
    A key/value pair with this key already exists in the store..
    ERROR      2008-04-23 11:36:21
               CJSlibModule::writeError_impl()
    CJS-30051  Cannot insert a key value pair into the secure store fails; see output of log file SecureStoreInsert.log:
    SAP Secure Store in the File System - Copyright (c) 2003 SAP AG
    A key/value pair with this key already exists in the store..
    TRACE      [iaxxejsbas.hpp:460]
               EJS_Base::dispatchFunctionCall()
    JS Callback has thrown unknown exception. Rethrowing.
    ERROR      2008-04-23 11:36:21 [iaxxgenimp.cpp:731]
               showDialog()
    FCO-00011  The step insertAdminDataInSecStore with step key |NW_Addin_CI|ind|ind|ind|ind|0|0|NW_CI_Instance|ind|ind|ind|ind|8|0|NW_CI_Instance_Configure_Java|ind|ind|ind|ind|4|0|insertAdminDataInSecStore was executed with status ERROR .
    TRACE      [iaxxgenimp.cpp:719]
               showDialog()
    There's any want in here can help us Please,
    Thanks and Best Regards,
    Chrisna

    The clean way to Uninstall JAVA is through SAPINST. 
    Make user you drop only the JAVA Schema ID (SAPSR3DB)
    If you want to uninstall manually, follow as mentioned below :
    1. Stop the central services instance and all dialog instances of your SAP system:
    a) Log on to the corresponding instance host as user <sapsid>adm.
    b) Execute the following commands:
       To stop the central services instance:
                 stopsap r3 <SCSinstanceName>
       To stop a dialog instance:
                stopsap r3 <DialogInstanceName>
    2. Stop the J2EE Engine of the central instance:
    a) Log on to your SAP system.
    b) Call transaction SMICM.
    c) Choose Administration J2EE Instance (local) Send Hard Shutdown
    2. Drop the J2EE DB schema (the db schema for this one SAP SID) BE VERY CAREFUL, do not drop the DB schema for another existing system or
    the ABAP schema.
    a. Log on as user ora<dbsid>.
    b. Start sqlplus and connect to the database. Enter:
    sqlplus /nolog
    c. SQLPLUS>connect / as sysdba
    d. Enter the following command to delete the database objects of the database schema:
    SQLPLUS> drop user SAP<SCHEMA_ID>DB cascade;
    e. Enter the following command to get the file name of the corresponding data file in the file system:
    SQLPLUS> select file_name from dba_data_files where \
    tablespace_name = ’PSAP<SCHEMA_ID>DB’;
    f. Enter the following command to delete the tablespace of the database schema:
    SQLPLUS> drop tablespace PSAP<SCHEMA_ID>DB including contents;
    g. Exit sqlplus:
    SQLPLUS> exit
    3. Remove folder "data" at: /sapmnt/QO1/global/security/data
    4. Remove folder "SDM" at: /usr/sap/<sid>/<Central instance>/SDM
    5. Remove folder "j2ee" at:  /usr/sap/<sid>/<Central instance>/j2ee
    6. Revert CI instance profile to their original state (backup copies should exist) # they should be in the state before the start of the JavaAdd In
    7. If lines beginning with the following parameters appear, delete these lines from the default profile, /usr/sap/<SAPSID>/SYS/profile/DEFAULT.PFL:
    j2ee/dbname =
    j2ee/dbtype =
    j2ee/dbhost =
    j2ee/dbadminurl =
    j2ee/scs/host =
    j2ee/scs/system =
    j2ee/ms/port =
    8. If lines beginning with the following parameters appear, delete these lines from the central instance pro?le and from all dialog instance pro?les,
    /usr/sap/<SAPSID>/SYS/profile/<SAPSID>_<INSTANCE_NAME>_<host_name>:
    exe/j2ee =
    exe/jlaunch =
    rdisp/j2ee_start_control =
    rdisp/j2ee_start =
    rdisp/j2ee_timeout =
    rdisp/j2ee_libpath =
    rdisp/frfc_fallback =
    jstartup/trimming_properties =
    jstartup/instance_properties =
    jstartup/protocol =
    jstartup/vm/home =
    jstartup/max_caches =
    jstartup/release =
    j2ee/dbdriver =
    9. Delete the central services instance
    10. Restart ABAP and Install JAVA Add-in
    Edited by: Shaji Jacob on Apr 27, 2008 11:46 AM

  • Pass multiple values as single input parameter into pipelined function

    Hi all,
    My need is to pass multiple values as single input parameter into pipelined function.
    For example - "2" and "3" are values of input parameter "t":
    with data as (
    select 1 as t from dual union all
    select 2 as t from dual union all
    select 3 as t from dual union all
    select 4 as t from dual union all
    select 5 as t from dual
    select * from data where t in (2,3)Is it possible at all?

    Not exactly sure, but usually 'multiple values'+'pipelined function' = some IN-LIST related approach?
    See:
    SQL> create table data as
      2  select 1 as t from dual union all
      3  select 2 as t from dual union all
      4  select 3 as t from dual union all
      5  select 4 as t from dual union all
      6  select 5 as t from dual;
    Table created.
    SQL> --
    SQL> CREATE OR REPLACE FUNCTION in_list (p_in_list  IN  VARCHAR2)
      2  RETURN sys.odcivarchar2list PIPELINED
      3  AS
      4    l_text  VARCHAR2(32767) := p_in_list || ',';
      5    l_idx   NUMBER;
      6  BEGIN
      7    LOOP
      8      l_idx := INSTR(l_text, ',');
      9      EXIT WHEN NVL(l_idx, 0) = 0;
    10      PIPE ROW (TRIM(SUBSTR(l_text, 1, l_idx - 1)));
    11      l_text := SUBSTR(l_text, l_idx + 1);
    12    END LOOP;
    13 
    14    RETURN;
    15  END;
    16  /
    Function created.
    SQL> --
    SQL> select *
      2  from   data
      3  where  t in ( select *
      4                from   table(in_list('1,2'))
      5              );
             T
             1
             2
    2 rows selected.http://www.oracle-base.com/articles/misc/dynamic-in-lists.php
    or
    http://tkyte.blogspot.nl/2006/06/varying-in-lists.html

  • Is it possible to load 1 billion key-value pairs into BerkeleyDB database?

    Hello,
    I experiment with loading huge datasets into BerkeleyDB database. The procedure is as follows:
    1. Generate a dump-like file using a script. The file contains key-value pairs (on separate lines, exactly in the format of the dump file, that can be produced by db_dump). The index is hash.
    2. Use db_load to create a database. The OS is windows server 2003.
    Both key and values are 64-bit longs.
    Using this procedure, I succeeded to load 25 million pairs in the database. It took about 1-2 hours.
    Next, I tried to load 250 million pairs into an empty database. db_loader runs already 15 hours. It's memory consumption is very low: private bytes ~2M, working set ~2M, virtual size ~13M. db_loader already read all the pairs from disk, as IO is very low now: ~4M per second. I am not sure if db_loader will finish in next 24h hours.
    My goal is to load eventually 3 billion key-value pairs into one DB.
    I will appreciate if someone will advise me:
    1. If BerkeleyDB is capable of dealing with such database volume.
    2. Is my procedure good, how to optimize it. Is it possible to allocate more RAM to db_load? Are there other ways to optimize loading time?
    Thank you,
    Gregory.

    Hello Sandra,
    The version is: Berkeley DB 5.0.21: (March 30, 2010).
    The data: keys and values are random 64 bit numbers.
    The header of the "dump" file that I am trying to load is (there are 256 * 1e6 key-value pairs in the file):
    VERSION=3
    format=bytevalue
    type=hash
    h_nelem=512000000
    db_pagesize=8192
    HEADER=END
    The db_load allocates 1G memory cache.
    Thank you,
    Gregory.

  • Cannot insert a key value pair into the secure store fails; see output of l

    Hi,
    how can I fix this problem ?
    SAPNW2004sJavaSP9_Trial\SAP_NetWeaver_2004s_SR_1
    jdkversion 142_09 .
    ERROR 2008-07-10 13:13:31
    CJS-30051  Cannot insert a key value pair into the secure store fails; see output of log file SecureStoreInsert.log: SAP Secure Store in the File System - Copyright (c) 2003 SAP AG
    Regds
    sas

    Hi Arzu,
    thank you for your replying.
    The current OS I am using is Microsoft Windows XP
    Service Pack 2.
    The very last installation was made with JDK version 142_12.
    However it was pointless. I can try to reinstall with
    the mentioned newest JCE policy files .
    Can tell me from where I can obtain these above
    JCE policy files ?
    Regards
    Erdem Sas

Maybe you are looking for

  • How do I share between users on the same macbook?

    I have a brand new macbook... the tool at the store wouldn't let me test drive this computer without him first putting a user account in place other than administrative rights (makes no sense to me either) Anyway, I set everything up under this usern

  • HOW TO MAKE A REVERSE VIDEO IN IMOVIE FOR IOS

    I woud like to know, if possible, in how to make a reverse video in my IPad. Thanks to everyone! G'day.

  • Shared Services 9.3.1 error - "...error loading tree data"

    We have recently upgraded to version 9.3.1 and have been using it for several months now. This past week, when logging in to Shared Services, we are suddenly experiencing a pop up with an error that says "There was a communication error while loading

  • Cloning a Database (and ORACLE_HOME

    I want to make a total copy of a database and its ORACLE_HOME. To me, this looks like a two step process: 1) Clone the ORACLE_HOME. I completed this successfuly using GC (10.1.0.4) 2) Clone the database using that cloned ORACLE_HOME. This doesn't app

  • UE-V support for Office 2013?

    Hi Can we expect a UE-V template for Office 2013 from Microsoft? Mario