Urgent help on reading data into ByteBuffer

Hi,
I am trying to read data into ByteBuffer using SocketChannel.
The following code working fine but the problem is with ByteBuffer size.
The data varies from request to request .
How do I read data into ByteBuffer with out specifing size .
The problem with size is some records has more than 500 bytes and some are less than 500 bytes.
I want to read all the data .. ( even if it has more than 500 bytes ..)
How do i solve this problem ..
Is there any way to read data dynamically from socket channel ...
Any help on this please ...
The data I have to read is in the following format ..
XXX ... yyyyy
AAA
BBBBBBBBBBBBBBBBBBBBBB
CCCCCCCCCCCCCCCCCCCC
DDDDDDDDDDDDDDDDDDDDDDd
etc ...
Here is my Code:
public ByteBuffer getResponse(byte[] request) throws Exception {
int lenth = 500;
InetSocketAddress isa = new InetSocketAddress("ip", port);
SocketChannel channel = SocketChannel.open(isa);
ByteBuffer requestBuffer = ByteBuffer.wrap(request);
channel.write(requestBuffer);
ByteBuffer responseByteBuffer = ByteBuffer.allocate(length);
int num = 0;
while (num == 0 ) {
responseByteBuffer.rewind();
num = channel.read(responseByteBuffer);
channel.close();
return responseByteBuffer;
Thanks.

Two possible solutions
1. Read in as many bytes as you can until you hit the EOS OR you fill the byte buffer. If you fill the buffer (try checking for BufferUnderFlowException), you could move the read bytes into a dynamically allocated memory Collection such as an ArrayList. When you hit the EOF, you could then do whatever else you need to do from then on.
2. I use this option: Implement a site local protocol for transmitting data. Provide a header first containing 2 ints (compressed size, uncompressed size - so you can also use compression when sending), and send the remainder as a payload.
Therefore
Read in the header first (always 8 bytes)
Then extract those integer values. They will tell you how much is being sent. Set you byte buffer for the payload to be the correct size for this transmission.
Reset and wait for next connection

Similar Messages

  • Urgent help in reading data from oracle

    Hi All
    I was reading the data from an oracle database table through jdbc and storing them in an ArrayList, since there were around 1000 records and performing the action by iterating through the arrayList
    But now the record count has gone up to 200000, so i don't want to store them in the ArrayList rather process them one after the other so that i can save the memory of the ArrayList
    What are the best ways of achieving this, do i need to use some tools or anything, please let me know?
    Any help would be greatly appreciated.
    Thanks
    Diana

    Reading one record at a time from the database is very very very slow. I suggest keeping it in a large array. Memory is cheap. Read up on 'java -xmx' on how to increase the amount of memory available for java if you think you are running out of memory.
    Do you really need all fields in a record and all records?
    If still need to process all records, you can fetch a subset of records (say, 10000) and process them, then fetch another subset. Your sql may support fetching a subset but I dont recall the syntax.

  • Gurus..need help in reading data from virtual infocube

    Gurus,
    I have to read data from an virtual infocube...I am trying to use FM RSDRI_INFOPROV_READ to read data but it doesn't work..
    I am doing exactly what has been done in the demo program RSDRi_INFOPROV_READ_DEMO...
    Please help me...its really URGENT...
    Thanks
    sam

    Check out this thread....
    must be helpful
    Re: Read data from 0BWTC_C02 via ABAP

  • Streaming data to disk, need help reading data into Power Spectrum/O​ctave vi

    I'm streaming data to disk in one loop, however once this finishes I'd like to read the data into power spectrum vi/Octave analysis vi in another loop. The data from the read vi is a string and power spectrum vi needs 1d waveform. Does anyone have experience with this process?

    From your general description, I gather you are streaming to a text based file (comma or tab separated spreadsheet format) and would like to analyse this data with a power spectrum or octave analysis when you finish. Since you are streaming, I assume you have a lot of data. Do you have more than one channel?
    In any case, you have two simple options (and lots of complex ones). You can either read the data back from disk and convert it to a 1D array (try the Read From Spreadsheet File.vi - will get a 2D array, take the first column or the column of your choice if you have more than one channel) or you can use the Spreadsheet String to Array primitive to create an array from your text data before you save it to disk.
    If your data rate is slow enough, you can analyze as you acquire and store.
    Taking your data as text is very inefficient. What you really want to do is read the data as binary, use that for your analysis, and use something like the Write to Spreadsheet File.vi to save text data to disk.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • Need help in reading data from Database.

    Hi experts,
    I have created a custom smartforms and custom print program. In my print program i have read all the data and populated the internal table and i am able to display the data in the smartform output.
    I'm using Tcode me23n to print preview the form. i have to read the "text" tab from the me23n tcode using FM  "READ_TEXT". The data is getting populated into an internal table. I coded these statements in Initialization tab in global definition.
    Now my problem is ..... Can anyone tell me how to display the data into the forms.
    please help.
    Thanks

    Follow below example to using FM 'READ_TEXT'
    DATA  BEGIN OF i_tlines OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA  END   OF i_tlines.
    DATA: w_textname(70) TYPE c.
      w_textname = vbdkr-vbeln.
      CALL FUNCTION 'READ_TEXT'
        EXPORTING
          client                        = sy-mandt
          id                            = 'Z006'
          language                      = 'E'
          name                          = w_textname
          object                        = 'VBBK'
        TABLES
          lines                         = i_tlines.
      IF sy-subrc = 0.
        READ TABLE i_tlines INDEX 1.
        t_in-m1 = i_tlines-tdline.   "Now t_in_m1 will have the value
      ENDIF.
    Regards,
    SaiRam

  • Reading Data into a PDF form with cfpdfform and cfpdfformparam

    I have been trying to read data from a query into a PDF form. I have the application setup to generate a new pdf file for every record in the database table which is working perfectly, but when I try to have the application pre-populate the form fields in the pdf form they remain empty. I have included a snippet of the code that creates the PDF documents. I am using Adobe LiveCycle Designer 8.0 to create the PDF form.
    Snippet Example:
    <cfoutput query="renewals">
    <cfset new_file = "#reportnumber#.pdf" />
    <cfpdfform action = "populate" source = "beta.pdf" destination = "#new_file#">
      <cfpdfformparam name="Legal_Contact_Name" value="#LegalContactName#">
    </cfpdfform>
    <cfpdf action = "write" source = "#new_file#" destination = "#new_file#" flatten = "yes" overwrite  = "yes" />
    </cfoutput>
    All help is greatly appreciated...

    I'm just glad I might be of any help.
    First, make sure the image is embeded as a base64 encoded string in the xml structure you're working with on your form you've built in LiveCycle Designer.
    I do this by reading the image file and outputing its content as a base64 string:
    <cffile action="read" file="#expandPath('Path/to/your/image/file/BC.TIF')#" variable="imgObj" />
    <img>#toBase64(imgObj)#</img>
    Your PDF form should be bound to this 'img' field from your xml structure in LiveCycle Designer.
    This works perfectly and the image from the xml is indeed displayed in the PDF form generated with cfpdf.
    BUT, from the moment you convert the pdf form to static pdf document, the image will be gone - the dynamic text remains.
    Note:  I never further investigated why the image disapears once the pdf form is converted to 'static' pdf.  Thinking about it now, it might have been an incoding issue.  The toBase64() function in ColdFusion has an optional "Encoding" argument, may be by playing with the encoding the image might finally 'survive' the conversion to static pdf.
    Good luck.
    note: this will populate the pdf form from your xml structure in ColdFusion.
    <cfpdfform action="populate" source="/path/to/LiveCycle_generated_templateForm.pdf" xmldata="#your_xml_structure#" destination="/path/to/result.pdf" overwrite="yes" />

  • Its very urgent:how to insert data into database tables

    Hi All,
    I am very new to oaf.
    I have one requirement data insert into database tables.
    here createPG having data that data insert into one custom table.
    but i dont know how to insert data into database tables.
    i wrote the code in am,co as follows.
    in am i wrote the code:
    public void NewoperationManagerLogic()
    ManagerCustomTableVOImpl vo1=getManagerCustomTableVO1();
    OADBTransaction oadbt=getOADBTransaction();
    if(!vo1.isPreparedForExecution())
    vo1.executeQuery();
    Row row=vo1.createRow();
    vo1.insertRow(row);
    in createPG processrequest co:
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    ManagerInformationAMImpl am=(ManagerInformationAMImpl)pageContext.getApplicationModule(webBean);
    am.NewoperationManagerLogic();
    process form request:
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    if(pageContext.getParameter("Submit")!=null)
    ManagerInformationAMImpl am=(ManagerInformationAMImpl)pageContext.getApplicationModule(webBean);
    am.getOADBTransaction().commit();
    please help with an example(sample code).
    its very urgent.
    thanks in advance
    Seshu
    Edited by: its urgent on Dec 25, 2011 9:31 PM

    Hi ,
    1.)You must have to create a EO based on custom table and then VO based on this EO eventually to save the values in DB
    2.) the row.setNewRowState(Row.STATUS_INITIALIZED); is used to set the the status of row as inialized ,this is must required.
    3.) When u will create the VO based on EO the viewattributes will be created in VO which will be assigned to the fields to take care the db handling .
    You must go thtough the lab excercise shipped with you Jdeveloper ,there is a example of Create Employee page ,that will solve your number of doubts.
    Thanks
    Pratap

  • Help to export data into a file

    Hi,
      I am having more than 200 columns in a table. Client wants to export the data into a file with all 215 columns data. When i write the select * from tablename into a spool file. It is getting the data into a multiple lines however client wants each record into a single line.(right now records are getting into multiple lines). I tried to use to_nclob(columnname1)....to_nclob(column215), this way it is getting a single line for each record but it is taking much time(means in a table we have 10M records and explain plan is showing 3 days to export the file). Could you please help me how we can achieve these type of functionalities.
    Thanks in advance

    user586 wrote:
    Hi,
      I am having more than 200 columns in a table. Client wants to export the data into a file with all 215 columns data. When i write the select * from tablename into a spool file. It is getting the data into a multiple lines however client wants each record into a single line.(right now records are getting into multiple lines). I tried to use to_nclob(columnname1)....to_nclob(column215), this way it is getting a single line for each record but it is taking much time(means in a table we have 10M records and explain plan is showing 3 days to export the file). Could you please help me how we can achieve these type of functionalities.
    Thanks in advance
    Hardly surprising it's taking ages to export 10 million rows, if you're doing it through SQL*Plus, as that involves transporting all the data over the network to the client, which is then rendering all that data in the display (which can be slow to scroll, depending on the size of the window) etc.
    Better to get the database to access the file system directly, using UTL_FILE (though this does mean that the file is produced on the server) and then transfer the resultant file to where it needs to go.
    Example of a generic template to use as a starting point...
    As sys user:
    CREATE OR REPLACE DIRECTORY TEST_DIR AS '\tmp\myfiles'
    GRANT READ, WRITE ON DIRECTORY TEST_DIR TO myuser
    As myuser:
    CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2
                                         ,p_dir IN VARCHAR2
                                         ,p_header_file IN VARCHAR2
                                         ,p_data_file IN VARCHAR2 := NULL) IS
      v_finaltxt  VARCHAR2(4000);
      v_v_val     VARCHAR2(4000);
      v_n_val     NUMBER;
      v_d_val     DATE;
      v_ret       NUMBER;
      c           NUMBER;
      d           NUMBER;
      col_cnt     INTEGER;
      f           BOOLEAN;
      rec_tab     DBMS_SQL.DESC_TAB;
      col_num     NUMBER;
      v_fh        UTL_FILE.FILE_TYPE;
      v_samefile  BOOLEAN := (NVL(p_data_file,p_header_file) = p_header_file);
    BEGIN
      c := DBMS_SQL.OPEN_CURSOR;
      DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
      d := DBMS_SQL.EXECUTE(c);
      DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
      FOR j in 1..col_cnt
      LOOP
        CASE rec_tab(j).col_type
          WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
          WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val);
          WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val);
        ELSE
          DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
        END CASE;
      END LOOP;
      -- This part outputs the HEADER
      v_fh := UTL_FILE.FOPEN(upper(p_dir),p_header_file,'w',32767);
      FOR j in 1..col_cnt
      LOOP
        v_finaltxt := ltrim(v_finaltxt||','||lower(rec_tab(j).col_name),',');
      END LOOP;
      --  DBMS_OUTPUT.PUT_LINE(v_finaltxt);
      UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
      IF NOT v_samefile THEN
        UTL_FILE.FCLOSE(v_fh);
      END IF;
      -- This part outputs the DATA
      IF NOT v_samefile THEN
        v_fh := UTL_FILE.FOPEN(upper(p_dir),p_data_file,'w',32767);
      END IF;
      LOOP
        v_ret := DBMS_SQL.FETCH_ROWS(c);
        EXIT WHEN v_ret = 0;
        v_finaltxt := NULL;
        FOR j in 1..col_cnt
        LOOP
          CASE rec_tab(j).col_type
            WHEN 1 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
                        v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
            WHEN 2 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
                        v_finaltxt := ltrim(v_finaltxt||','||v_n_val,',');
            WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
                        v_finaltxt := ltrim(v_finaltxt||','||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'),',');
          ELSE
            DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
            v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
          END CASE;
        END LOOP;
      --  DBMS_OUTPUT.PUT_LINE(v_finaltxt);
        UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
      END LOOP;
      UTL_FILE.FCLOSE(v_fh);
      DBMS_SQL.CLOSE_CURSOR(c);
    END;
    This allows for the header row and the data to be written to seperate files if required.
    e.g.
    SQL> exec run_query('select * from emp','TEST_DIR','output.csv');
    PL/SQL procedure successfully completed.
    Output.csv file contains:
    empno,ename,job,mgr,hiredate,sal,comm,deptno
    7369,"SMITH","CLERK",7902,17/12/1980 00:00:00,800,,20
    7499,"ALLEN","SALESMAN",7698,20/02/1981 00:00:00,1600,300,30
    7521,"WARD","SALESMAN",7698,22/02/1981 00:00:00,1250,500,30
    7566,"JONES","MANAGER",7839,02/04/1981 00:00:00,2975,,20
    7654,"MARTIN","SALESMAN",7698,28/09/1981 00:00:00,1250,1400,30
    7698,"BLAKE","MANAGER",7839,01/05/1981 00:00:00,2850,,30
    7782,"CLARK","MANAGER",7839,09/06/1981 00:00:00,2450,,10
    7788,"SCOTT","ANALYST",7566,19/04/1987 00:00:00,3000,,20
    7839,"KING","PRESIDENT",,17/11/1981 00:00:00,5000,,10
    7844,"TURNER","SALESMAN",7698,08/09/1981 00:00:00,1500,0,30
    7876,"ADAMS","CLERK",7788,23/05/1987 00:00:00,1100,,20
    7900,"JAMES","CLERK",7698,03/12/1981 00:00:00,950,,30
    7902,"FORD","ANALYST",7566,03/12/1981 00:00:00,3000,,20
    7934,"MILLER","CLERK",7782,23/01/1982 00:00:00,1300,,10
    The procedure allows for the header and data to go to seperate files if required.  Just specifying the "header" filename will put the header and data in the one file.
    Adapt to output different datatypes and styles are required.

  • Help! Inserting data  into database

    Hi,
    I have problem in inserting new data into database.
    This is my code used.
    PROCEDURE insert_contact IS
    BEGIN
    GO_BLOCK('BLOCK3');
    first_record;
    LOOP
    insert into LIMS_JOB_LEVEL
         (JOB_LEVEL_CODE,JOB_LEVEL_DESC,LAST_UPD_ID,LAST_UPD_DATE)
         values
         ('FAF','FDSAFS','FDSAF','1-1-01');
         EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE';
         next_record;
    END LOOP;
    END;
    And I cannot insert the data.Can anyone help me to solve this
    problem of mine.
    Thanks a lot.

    I belive this got to do with the date format. There is another
    posting about this after your posting and there are couple of
    good solutions in there for the date formating. Please refer.

  • Urgent help needed: registry.dat is missing when i run my form in web base

    Hi gurus,
    i configured my forms and report server in windows 2003 and i received the following error msg when tryin to access my web base forms 6I.
    FRM-92129: Registry file http://domain.com/form60java/oracle/forms/registry/Registry.dat is missing.
    Details...
    Java Exception:
    oracle.forms.engine.RunformException: FRM-92120: Registry file http://domain.com/form60java/oracle/forms/registry/Registry.dat is missing.
    at oracle.forms.engine.Runform.initRegistry(Unknow Source)
    at oracle.forms.engine.Runform.startRegistry(Unknow Source)
    at oracle.forms.engine.Main.createRunform(Unknow Source)
    at oracle.forms.engine.Main.start(Unknow Source)
    at sun.applet.JinitAppletPanel.run(Compiled code)
    at java.lang.Tread.run(Thread.java:466)
    what can be goes wrong with my steps to receive the above error?? i tried in windows XP and Vista, and i getting the same error message as above.
    Your urgent help and advise is needed plssssssss.......
    Many thanks in advance.

    The URL doesn't seem correct: http://domain.com/form60java/oracle/forms/registry/Registry.dat
    I'm expecting a slash (/) between forms60 and java. Have a look in the formsweb.cfg if any paths are misconfigured.
    Also, try if the URL with the slash:
    http://domain.com/form60/java/oracle/forms/registry/Registry.dat
    does work when you just paste it in a browser. It should download the Registry.dat file

  • Need help in putting data into 2d array

    My input file :
    1 , 2 , 1
    2 , 2 , 1
    3 , 3 , 1
    4 , 2 , 2
    2 , 3 , 2I'm stuck at:
    while( reader.readLine() != null){
    String Matrix[] = line.split(",");
    }Means I only can read how many lines there. For 2d array, Matrix[i][j], is that when I count the line, the number of count will be the 'i'? How about 'j'? Am I need to count i and j before put the data into 2d array?
    Do correct me if something wrong in:
    while( reader.readLine() != null){
    String Matrix[] = line.split(",");
    } Thank you.

    gtt0402 wrote:
    while( reader.readLine() != null){
    String Matrix[] = line.split(",");
    How about:
    ArrayList<String[]> rows = new ArrayList<String[]>();
    while((line = reader.readLine()) != null) {
        rows.add(line.split(","));
    }After the loop you have a list full of String arrays and you can convert it to a 2D String array if you wish.

  • Urgent: Problem with reading data from cube.

    Hi Gurus,
    I am trying to read the data from the cube. Below is my code. It returns nothing. Could any please help me to solve this.
    TYPES:
      BEGIN OF S_DATA,
        Z_CHAR1    like  /BIC/CTABLE-ZCHAR1,
        Z_CHAR2    like  /BIC/CTABLE-ZCHAR2,
        Z_CHAR3    like /BIC/CTABLE-ZCHAR3,
        Z_FISCPER  like /BIC/CTABLE-0FISCPER,
        0AMOUNT    type  p DECIMALS 2,
      END OF S_DATA.
    data:
           i_s_data  TYPE s_data,
           i_t_data  TYPE STANDARD TABLE OF s_data
                          WITH DEFAULT KEY INITIAL SIZE 10,
           c_data TYPE s_data occurs 0 with header line,
           i_s_sfc   TYPE rsdri_s_sfc,
           i_th_sfc  TYPE rsdri_th_sfc,
           i_s_sfk   TYPE rsdri_s_sfk,
           i_th_sfk  TYPE rsdri_th_sfk,
           i_s_range TYPE rsdri_s_range,
           i_t_range TYPE rsdri_t_range.
    DATA: end_of_data  TYPE rs_bool,
         clear: i_th_sfc.
         g_s_sfc-chanm    = 'Z_CHAR1'.
         g_s_sfc-chaalias = 'Z_CHAR1'.
         g_s_sfc-orderby  = 0.
         INSERT i_s_sfc INTO TABLE i_th_sfc.
         clear: i_s_sfc.
         g_s_sfc-chanm    = 'Z_CHAR2'.
         g_s_sfc-chaalias = 'Z_CHAR2'.
         g_s_sfc-orderby  = 0.
         INSERT i_s_sfc INTO TABLE i_th_sfc.
         clear: i_s_sfc.
         g_s_sfc-chanm    = 'Z_CHAR3'.
         g_s_sfc-chaalias = 'Z_CHAR3'.
         g_s_sfc-orderby  = 0.
         INSERT i_s_sfc INTO TABLE i_th_sfc.
         clear: i_s_sfc.
         g_s_sfc-chanm    = 'Z_FISCPER'.
         g_s_sfc-chaalias = 'Z_FISCPER'.
         g_s_sfc-orderby  = 0.
         INSERT i_s_sfc INTO TABLE i_th_sfc.
         clear: i_s_sfk..
         g_s_sfk-kyfnm    = '0AMOUNT'.
         g_s_sfk-kyfalias = '0AMOUNT'.
         g_s_sfk-aggr     = 'SUM'.
         INSERT i_s_sfk INTO TABLE i_th_sfk.
          clear: i_t_range, i_s_range.
          i_s_range-chanm    = 'Z_FISCPER'.
          i_s_range-sign     = rs_c_range_sign-including.
          i_s_range-compop   = rs_c_range_opt-equal.
          i_s_range-low      = 200601.
          i_s_range-high     = 200606.
          APPEND i_s_range TO i_t_range.
            CALL FUNCTION 'RSDRI_INFOPROV_READ'
              EXPORTING
                i_infoprov             = 'ZC_CUBE'
                i_th_sfc               = i_th_sfc
                i_th_sfk               = i_th_sfk
                i_t_range              = i_t_range
                i_reference_date       = sy-datum
                i_save_in_table        = rs_c_false
                i_save_in_file         = rs_c_false
                i_packagesize          = 20
              IMPORTING
                e_t_data               = i_t_data
                e_end_of_data          = end_of_data
              CHANGING
                c_first_call           = i_first_call
              EXCEPTIONS
                illegal_input          = 1
                illegal_input_sfc      = 2
                illegal_input_sfk      = 3
                illegal_input_range    = 4
                illegal_input_tablesel = 5
                no_authorization       = 6
                ncum_not_supported     = 7
                illegal_download       = 8
                illegal_tablename      = 9
                OTHERS                 = 11.
                append lines of I_t_data to c_data.
    Thanks
    Regards
    aarthi
    [email protected]

    Due to the nature of the cube design, that would be difficult, that's why there are API's, FMs, and MDX capabilities - to eliminate the need to navigate the physical structure.  Otherwise you would have to concern yourself with:
    - that there are two fact tables E and F that would need to be read.  The Factview could take of this one.
    - you would want to be able to read aggregates if they were available.
    - the fact table only as DIM IDs or SIDs (for line item dims) to identify the data, not characteristic values.  A Dim ID represents a specific combination of characteristic values.

  • Need Help in reading data from URLConnection in servlets

    hi i created GUI which sends d username n password to the servlets via URLConnection.n am sending the same to Server program via sockets.but when i read d data in the servlet am getting only null value...need help here....
    This is my button's ActionPerformed code
    private void LoginActionPerformed(java.awt.event.ActionEvent evt) {
    String uname = UserName.getText();
    char [] pwd = PassWord.getPassword();
    String pword = new String(pwd);
    try
    String url = "http://localhost:8080/MIMServlets/hit";
    URL ucon = new URL(url);
    URLConnection conn = ucon.openConnection();
    conn.setDoOutput(true);
    conn.setDoInput(true);
              conn.setUseCaches (false);
    conn.setDefaultUseCaches (false);
    conn.setRequestProperty("Content-Type", "text/plain");
    System.out.println(uname);
         System.out.println(pword);
         PrintWriter out = new PrintWriter( conn.getOutputStream() );
    BufferedReader in = new BufferedReader(
    new InputStreamReader(
    conn.getInputStream()));
         out.print(uname);
    out.print(pword);
         out.close();
    String inputLine = in.readLine();
    Status.setText(inputLine);// TODO add your handling code here:
    }catch(MalformedURLException e)
    System.out.println("Exception"+e);
    catch(IOException e1)
    System.out.println("Exception"+e1);
    This is my Servlet code........
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class MIMServlets extends HttpServlet
    PrintWriter out,out1;
         BufferedReader in,in1;
         String host = "localhost";
         String fromServer = "";
         String username,password;
         int a;
         public void init()
    out=null;
    out1=null;
    public void doPost(HttpServletRequest request,HttpServletResponse
                   response)throws ServletException,IOException
              response.setContentType("text/html");
              out=response.getWriter();
              try{
              InetAddress address = InetAddress.getByName(host);
    Socket theSocket = new Socket(address, 4444);
    out1 = new PrintWriter(theSocket.getOutputStream(),true);
    in = new BufferedReader(new InputStreamReader(theSocket.getInputStream()));
    in1 = new BufferedReader(new InputStreamReader(request.getInputStream()));
              String username = in1.readLine();
              String password = in1.readLine();
    System.out.println(username);
              System.out.println(password);
    out1.println(username);
              out1.println(password);
              out1.println("Yahoo");
              out1.flush();
    while ((fromServer = in.readLine()) != null)
    out.println("From Server: " + fromServer);
              break;
         out1.close();
    in.close();
    theSocket.close();
         }catch(IOException e)
    System.out.println("Exception");
    System.exit(-1);
              public void destroy()
         out.close();
    thanks in advance.......

    Follow below example to using FM 'READ_TEXT'
    DATA  BEGIN OF i_tlines OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA  END   OF i_tlines.
    DATA: w_textname(70) TYPE c.
      w_textname = vbdkr-vbeln.
      CALL FUNCTION 'READ_TEXT'
        EXPORTING
          client                        = sy-mandt
          id                            = 'Z006'
          language                      = 'E'
          name                          = w_textname
          object                        = 'VBBK'
        TABLES
          lines                         = i_tlines.
      IF sy-subrc = 0.
        READ TABLE i_tlines INDEX 1.
        t_in-m1 = i_tlines-tdline.   "Now t_in_m1 will have the value
      ENDIF.
    Regards,
    SaiRam

  • URGENT HELP in multilingual data saving

    Hi,
    We are trying to create a multilingual application using Java and Oracle.
    In the browser, my charset encoding is UTF8, then my database charset is
    defined as WE8ISO8859P1. If i try to send a data (latvian language)
    and save it in the database, the data being saved is in the form of question
    marks (????????). What it is that i need to do in order to save the correct
    data.
    Another question is, what is the character set/encoding that can be used to
    save data in the database using Latvian, Slovenian, English and Russian languages
    besides the UTF8 encoding???? Is the WE8ISO8859P1 encoding considered also as
    Unicode????? One more thing is, if i send the data and access it in the
    servlet, do i need to perform the getBytes() for each form textfield elements in
    order to get the correct data to be saved??? What is the fastest way to test
    the correct saving of data in the database????
    Any help will be greatly appreciated. Thanks a lot in advance!!!!!!!!!!!!!!
    ayen

    Hello
    Here goes,
    Server side:
    Create or change your database to UTF-8 (see documentation on howto create or change an existing database with the UTF-8 characterset, quiet easy)
    Client side
    Change in your registry (I use Windows 2000), the key value NLS_LANG to AMERICAN_AMERICA.UTF8
    Your Oracle Forms and Oracle Reports and generated HTML pages using mod_plsql, or java, will now work in multilanguages. You will be able to input and output the correct characters (russian, french, ...), except in SQL*Plus.
    Anyway, it works for me.
    Good luck.

  • Urgent Help With Master Data

    Hi to all,
    I load every day a customer hierarchy from R/3 in Infoobject 0Cust_slaes and from today i have not any values in the hierarchy.
    After i run RSRV for 0cust_sales Hierarchies i got  the following messge error :
    The INCFL flag in SID table is missing for hierarchy leaf 3 with SID 3
    The INCFL flag in SID table is missing for hierarchy leaf 7 with SID 7
    The INCFL flag in SID table is missing for hierarchy leaf 9 with SID 9
    The INCFL flag in SID table is missing for hierarchy leaf 5670 with SID 5670
    RSRV does not give the opotion to correct error. How to resolve this ?
    Thank you in advance all for your help, it is urgent for me,
    -Panos.

    Hi,
    Is there any processing running presently on the hierarchy table of That Info object. It looks as Dead lock problem. If no process is running(SM50) on this table, check for locks on this table in SM21. If you find any locks delete them manually and upload hte Hierarchy data one more time.
    With rgds,
    Anil Kumar Sharma .P

Maybe you are looking for