Chinese character in the csv file

Hi all,
I have code below , I am using OpenCSV API to write data to csv.
I am using jdk1.4 and NetBean 6.1 and database is DB2.
The DB2 encoding is UTF-8 , the chinese data is inserted correct to database , but when i tried to retrieve it using
rs.getString("REGISTER_NAME") , it display "???????" , below is the code
FileWrite fileWriter = new FileWriter(PARENT_PATH + WRITE_FILE);
CSVWriter writer = new CSVWriter(fileWriter);
// feed in your array (or convert your data to an array)
while (rsVoucherCode.next()) {
String register_name = rsVoucherCode.getString("REGISTER_NAME");
System.out.println("register_name :" + register_name);
String test = new String(register_name.getBytes("UTF-8"), "Big5");
int register_optin = rsVoucherCode.getInt("REGISTER_OPTIN");
String[] entries = (test+"#"+String.valueOf(register_optin)).split("#");
writer.writeNext(entries);
writer.close();
Anyone have any ideas or suggestion is much appreciated . Thanks

yeoweetat wrote:
I have change the code below to use encoding type to Cp1252 ,
However the data are not display correctly . of course it won't display correctly. because the Cp1252 encoding is for Japanese fonts, not for Chinese. Please find the suitable encoding type and change accordingly.

Similar Messages

  • How to put chinese character in the Manifest file

    Hi,
    I want to know that how can we put chinese characters in the manifest file. Please suggest a solution.
    Regards

    [slightly confused stuff removed]Sorry, AmitChalwade123456, I know trolling can be very funny, but you're confusing the sh*t out of newbies with this almost-seems-usefull kind of talk.
    Stop that.
    And in case you really meant that seriously: Please refrain from giving advice with regard to encoding. What you posted is wrong (to put it mildly).

  • About the character-code of the csv file

    Hi All
    The csv file is made by using the Write_File action.
    Is it possible to make it by character-code "ANSI"?
    Any assistance would be appreciated.
    Thanks,
    hikeda

    guorke,
    I suggest you add userlog to the server to see the tpreturn situation and compare with tpcall's return code. iSucess is -1 means something wrong, other values such as 64, 128... means the tpcall's execution scucessfully and they are code related with internal handler index.
    Wayne

  • Chinese character overlap in PDF file

    Hi guyz,
    I am working on the issue on Chinese character overlap in PDF file.
    There is smartform which is being used to generate ePaySlip(Comes in email) in PDF file format which contains Chinese and English both characters.
    Now the issue is that at the bottom of the ePaySlip there is a Remark section which is maintained in Chinese and English both. However, the English sentences are proper withour any problem whereas the same thing in Chinese is showing as distorted/overlapped in few words.
    Can anyone suggest what could be the cause and suggest some solution.
    As when I checked in smartform those characters are hard coded and Chinese characters are shown as ###.
    Please response, I would be really grateful.
    Thanks & Regards,
    Mini

    Hi,
    there a different things to know.
    I produce sapscript forms with cinese and english characters for frontend / backend and archiv printing.
    Please check:
    Editor displays ###: You have to install the chinese language in your e.g. windows-system to display them.
    Script: You have to chose the the font family "CNSONG" (customized for chinese simplified and LATIN).
    Transaction I18N: May you have to set correct subfonts for the unicode areas (Cascading fonts, Standard is Courier).
    You can print in different ways:
    For archiv/PDF: Install the unicode truetype font with chinese characters for the pdf-converter.
    For Frontend: Use the Frontendprinter SAPWIN or SAPWIN*CF (Cascading Font) to send it to the gui (note: SAPLPD does not support it, use the newer technology.....)
    Backend printing: POSTSCRIPT is not yet implemented :-((
    PLease note: What you see in spool / print preview is a simulation of the possible print, but backend print is not frontend preview!!!!
    Regards,
    Christian

  • How to include seconds and millisecon​d in the CSV file time stamp generated by the SpreadShee​t Object?

    I'm Using Lookout 6.02, in a XP Pro Windows Machine, Service Pack 3.
    I have an application that collects data at the rate of 20 samples per second. It works just fine, the CSV File contains all the samples without missing a single one.
    The problem is that the time stamp in the data file only shows hours and minutes. With 20 sample per second, there are 1200 samples per minute. It is hard to figure out in which second or sample number, occurred some events collected. These files are open with Excel and analyzed with Excel. There is no easy way to implement a search or a guidance for knowing the sample number or the exact time in Excel.  My problem is to add the seconds and if possible the milliseconds to the time stamp done by the spreadsheet object.
    Any suggestion?
    Other ways to do the same that includes the time stamp all the way down to milliseconds?

    Create another column with the Now() function, then set the calumn format to hh:mm:ss.s
    expression would be now(trigger) for the date and time or now(trigger)-today(trigger) for just time
    The trigger will cause the expression to stay updated, perhaps using the same trigger for logging the spreadsheet.
    Good luck
    Mike
    Message Edited by Mike@DTSI on 01-16-2009 04:12 PM
    Mike Crabtree - Lead Developer
    Destek of Nevada, Inc. / Digital Telemetry Systems, Inc.
    (866) 964-6948 / (760) 247-9512

  • How to asssign output value in the CSV file for the specific header

    Hi,
    I am using OpenScript 9.10. The problem I am facing is that, to Write the Output value captured from the application, When i am trying to use the methods "Appen String to File" i am unable to write / assign the out put value below the specific header. Can any one please look into this and post the methods related to Write the output vaues in to the CSV files under specific headers.
    Thanks in Advance.
    Thanks.,
    Siva

    Hi Alex,
    Thanks for your reply.I need to write the output value under specified parameter name.
    for example after creating the sales order,the order number have to write in the CSV file under
    OrderNumber column.I tried with appendStringtofille() method,by using this able to write the value under
    first column.But i need to write output value under specified columnname(means Header name in the cSV
    file).can u please give a reply for the above problem.
    Note: In that Csv file i am taking the input vales and also need to write the output values under
    specified column(header)
    Thanks,
    Siva Thota.

  • How to write the char value as is in the CSV file

    Hi Everyone,
    I am creating csv files which contains inventory details for all the products. I am able to create the csv file with utl file concepts. My problem starts after the csv file is being created.
    some of the product numbers(Though I am saying Product number, it is varchar2 data type in the table) is like this 3E-12, 3E-54 and so on. I have totally 23 product numbers like this.
    When the user opens the csv file it is changing to numbers like this 3.00E-12, 3.00E-54. I want to keep the product number as it is like char value. I tried many quoting and concat methods.
    But none of them works for me.
    I am using oracle 9i.
    Oracle9i Enterprise Edition Release 9.2.0.7.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.7.0 - Production
    Please help me to solve this problem.
    Thanks in advance,
    Vimal...

    Hi Friends,
    Thanks for the immediate response. Here is my code.
    CREATE OR REPLACE PROCEDURE DATA_TO_CSV_FILE
    IS
    l_file_ptr UTL_FILE.file_type;
    l_hdr_text VARCHAR2 (4000);
    l_dynamic_sql_str VARCHAR2 (4000);
    TYPE l_dynamic_sql IS REF CURSOR;
    l_dynamic_cursor l_dynamic_sql;
    l_org_id_select VARCHAR2 (200);
    l_master_org_id NUMBER;
    l_category VARCHAR2 (40);
    l_itemno VARCHAR2 (40);
    l_description VARCHAR2 (240);
    l_brand VARCHAR2 (240);
    l_organization_id NUMBER;
    l_oh NUMBER;
    l_status apps.mtl_system_items.inventory_item_status_code%TYPE;
    BEGIN
    l_file_ptr := UTL_FILE.fopen ('CSV_DIR', 'inventory.csv', 'w');
    l_dynamic_sql_str :=
    'SELECT mc.segment2 CATEGORY, itm.segment1 itemno '
    || 'itm.description description, LOG.brand brand,'
    || 'NVL (m.oh, 0) oh'
    || '(select msi.inventory_item_status_code from apps.mtl_system_items msi'
    || ' where msi.inventory_item_id = itm.inventory_item_id'
    || ' and msi.organization_id = '
    || l_master_org_id
    || ' ) status '
    || ' FROM xxx_custom_table m,'
    || ' apps.mtl_item_categories ic,'
    || ' apps.mtl_categories_b mc,'
    || ' apps.mtl_system_items itm,'
    || ' xxx_custom_table1 LOG,'
    || ' xxx_custom_table2 cap'
    || ' WHERE m.item_id(+) = itm.inventory_item_id'
    || ' AND m.org_id(+) = itm.organization_id'
    || ' AND itm.segment1 = cap.itemno(+)'
    || ' AND itm.inventory_item_id = ic.inventory_item_id'
    || ' AND itm.organization_id = ic.organization_id'
    || ' AND ic.category_id = mc.category_id'
    || ' AND mc.segment2 IS NOT NULL'
    || ' AND itm.inventory_item_id = LOG.inventory_item_id'
    || l_org_id_select
    || ' GROUP BY mc.segment2,'
    || ' itm.segment1,itm.inventory_item_id,itm.description,'
    || ' LOG.brand,LOG';
    OPEN l_dynamic_cursor FOR l_dynamic_sql_str;
    LOOP
    FETCH l_dynamic_cursor
    INTO
    l_category, l_itemno, l_description, l_brand, l_status,l_oh;
    EXIT WHEN l_dynamic_cursor%NOTFOUND;
    UTL_FILE.put_line (
    l_file_ptr,
    l_CATEGORY
    || ','
    || l_itemno
    || ','
    || l_description
    || ','
    || l_status
    || ','
    || l_brand
    || ','
    || l_oh
    END LOOP;
    UTL_FILE.fclose (l_file_ptr);
    END;
    Hey damorgan,
    Can you please give me little more detail about your workaround method. I think I did the ODBC Connection Once for MS ACCESS database. I
    hope you are taking about the same method.
    Thanks
    Vimal....

  • To read the csv file using collections

    i am able to retrieve each row of the csv file which is in table format But in some columns the data entered is in two or three lines while retriving the row, the program is taking The second line of that column as the second row of that file
    how could i display the entire row of that file in a single line.
    i have done this program could u please help out in this program
    package fileReading;
         import java.io.BufferedReader;
         import java.io.FileReader;
         import java.util.*;
         import java.util.Vector;
    public class FileReading
         public static void main(String args[]){
         try{
         String line;
         int startInd,endInd;
         char FieldSeparator = ',';
    //       List recordset;
         Map recordset;
         Vector record;
         int recordNumber=0;
    //       recordset = new ArrayList();
         recordset = new HashMap();
         BufferedReader in = new BufferedReader(new FileReader("c:\\GEMSBBtest.csv"));
         line = in.readLine();
         line = in.readLine();
         do{
         int len = line.length();
         record = new Vector();
    //       System.out.println(line);
         for(startInd = -1, endInd = 0; endInd >=0; ){
         endInd = line.indexOf(FieldSeparator,startInd+1 );
         if (endInd < 1){
         record.add(line.substring(startInd+1,len));
    //       System.out.println(line.substring(startInd+1,len));
         else{
         record.add(line.substring(startInd+1,endInd));
    //       System.out.println(line.substring(startInd+1,endInd));
         startInd = endInd;
         recordNumber++;
    //       recordset.add(record);
         recordset.put(Integer.toString(recordNumber),record);
         line = in.readLine();
    if (recordNumber<3)
         System.out.println(line);
         }while(line!=null);
         System.out.println(recordset.size());
         //System.out.println(recordNumber);
         }catch(Exception e){
         System.out.println(e.toString());
         }

    No there is no such special characters.Actually the file which there in xls format is being converted to csv format
    Now in each cell there r multiple lines and i need to print each row in a single line including that multiple line column or cell

  • How to write the JTables Content into the CSV File.

    Hi Friends
    I managed to write the Database records into the CSV Files. Now i would like to add the JTables contend into the CSV Files.
    I just add the Code which Used to write the Database records into the CSV Files.
    void exportApi()throws Exception
              try
                   PrintWriter writing= new PrintWriter(new FileWriter("Report.csv"));
                   System.out.println("Connected");
                   stexport=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
                   rsexport=stexport.executeQuery("Select * from IssuedBook ");
                   ResultSetMetaData md = rsexport.getMetaData();
                   int columns = md.getColumnCount();
                   String fieldNames[]={"No","Name","Author","Date","Id","Issued","Return"};
                   //write fields names
                   String rec = "";
                   for (int i=0; i < fieldNames.length; i++)
                        rec +='\"'+fieldNames[i]+'\"';
                        rec+=",";
                   if (rec.endsWith(",")) rec=rec.substring(0, (rec.length()-1));
                   writing.println(rec);
                   //write values from result set to file
                    rsexport.beforeFirst();
                   while(rsexport.next())
                        rec = "";
                         for (int i=1; i < (columns+1); i++)
                             try
                                    rec +="\""+rsexport.getString(i)+"\",";
                                    rec +="\""+rsexport.getInt(i)+"\",";
                             catch(SQLException sqle)
                                  // I would add this System.out.println("Exception in retrieval in for loop:\n"+sqle);
                         if (rec.endsWith(",")) rec=rec.substring(0,(rec.length()-1));
                        writing.println(rec);
                   writing.close();
         }With this Same code how to Write the JTable content into the CSV Files.
    Please tell me how to implement this.
    Thank you for your Service
    Jofin

    Hi Friends
    I just modified my code and tried according to your suggestion. But here it does not print the records inside CSV File. But when i use ResultSet it prints the Records inside the CSV. Now i want to Display only the JTable content.
    I am posting my code here. Please run this code and find the Report.csv file in your current Directory. and please help me to come out of this Problem.
    import javax.swing.*;
    import java.util.*;
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.table.*;
    public class Exporting extends JDialog implements ActionListener
         private JRadioButton rby,rbn,rbr,rbnore,rbnorest;
         private ButtonGroup bg;
         private JPanel exportpanel;
         private JButton btnExpots;
         FileReader reading=null;
         FileWriter writing=null;
         JTable table;
         JScrollPane scroll;
         public Exporting()throws Exception
              setSize(550,450);
              setTitle("Export Results");
              this.setLocation(100,100);
              String Heading[]={"BOOK ID","NAME","AUTHOR","PRICE"};
              String records[][]={{"B0201","JAVA PROGRAMING","JAMES","1234.00"},
                               {"B0202","SERVLET PROGRAMING","GOSLIN","1425.00"},
                               {"B0203","PHP DEVELOPMENT","SUNITHA","123"},
                               {"B0204","PRIAM","SELVI","1354"},
                               {"B0205","JAVA PROGRAMING","JAMES","1234.00"},
                               {"B0206","SERVLET PROGRAMING","GOSLIN","1425.00"},
                               {"B0207","PHP DEVELOPMENT","SUNITHA","123"},
                               {"B0208","PRIAM","SELVI","1354"}};
              btnExpots= new JButton("Export");
              btnExpots.addActionListener(this);
              btnExpots.setBounds(140,200,60,25);
              table = new JTable();
              scroll=new JScrollPane(table);
              ((DefaultTableModel)table.getModel()).setDataVector(records,Heading);
              System.out.println(table.getModel());
              exportpanel= new JPanel();
              exportpanel.add(btnExpots,BorderLayout.SOUTH);
              exportpanel.add(scroll);
              getContentPane().add(exportpanel);
              setVisible(true);
          public void actionPerformed(ActionEvent ae)
              Object obj=ae.getSource();
              try {
              PrintWriter writing= new PrintWriter(new FileWriter("Report.csv"));
              if(obj==btnExpots)
                   for(int row=0;row<table.getRowCount();++row)
                             for(int col=0;col<table.getColumnCount();++col)
                                  Object ob=table.getValueAt(row,col);
                                  //exportApi(ob);
                                  System.out.println(ob);
                                  System.out.println("Connected");
                                  String fieldNames[]={"BOOK ID","NAME","AUTHOR","PRICE"};
                                  String rec = "";
                                  for (int i=0; i <fieldNames.length; i++)
                                       rec +='\"'+fieldNames[i]+'\"';
                                       rec+=",";
                                  if (rec.endsWith(",")) rec=rec.substring(0, (rec.length()-1));
                                  writing.println(rec);
                                  //write values from result set to file
                                   rec +="\""+ob+"\",";     
                                   if (rec.endsWith(",")) rec=rec.substring(0,(rec.length()-1));
                                   writing.println(rec);
                                   writing.close();
         catch(Exception ex)
              ex.printStackTrace();
         public static void main(String arg[]) throws Exception
              Exporting ex= new Exporting();
    }Could anyone Please modify my code and help me out.
    Thank you for your service
    Cheers
    Jofin

  • How to export out the date into the csv file?

    Hi, I had been trying to export out the value of the date to csv file.
    This is the  script:
    $strADPath = 'LDAP://dc=test,dc=com'
    function ConvertLargeIntegerToDate([object]$LargeInteger){
    try
    $int64 = ConvertLargeIntegerToInt64 ($LargeInteger)
    if ($int64 -gt 0)
    $retDate = [datetime]::fromfiletime($int64)
    else
    $retDate = $null
    return $retDate
    catch
    return $null
    $objSearch = New-Object DirectoryServices.DirectorySearcher
    $objSearch.Filter = '(&(objectClass=user)(samaccountname=user1))'
    $objSearch.SearchRoot = $strADPath
    $objSearch.PageSize = 1000
    $objSearch.SearchScope = "subtree"
    $objResults = $objSearch.Findall()
    $dateAccountExpires = ConvertLargeIntegerToDate $objUser.accountexpires[0]
    Write-Host "date Account expires: " $dateAccountexpires
    $objResults| ForEach-Object{
    $_.GetDirectoryEntry()
    } |
    Select-Object -Property @{Name="sAMaccountName";Expression={$_.sAMAccountName}},
    @{Name="cn";Expression={$_.cn}},
    @{Name="name";Expression={$_.name}},
    @{Name="manager";Expression={$_.manager}},
    @{Name="givenName";Expression={$_.givenName}},
    @{Name="accountExpires";Expression={$_.dateAccountExpires}},
    @{Name="department";Expression={$_.department}} |
    Export-Csv -Path 'D:\test44.csv'
    This is what I get in PowerShell ISE:
    This is what I had get for the csv file for the expire date:

    hi FWN,
    the code had giving me error saying that it could not call method on a null-value expression.
    $temp = $_.Properties
    the code had gave error saying that it could not call method on a null-value expression.
    $properties | %{ $res.$_ = $temp.Item($_) }
    the code had gave error saying that it could not call method on a null-value expression.
    with lot of thanks
    noobcy

  • How to align the CSV file on upload?

    Hi All,
    I have to upload a CSV file as an attachment in a mail and the data's in the internal table which has to be uploaded in the CSV file are seperated using commas which on uploading appear in the CSV file in the same column but i need the data's to be seperated in different columns and different lines...
    Pls help it is very urgent..
    Thanks in Advance...

    Hi
    For my understanding you are talking about download.
    For that you have to concatenate each fields of final internal table (gt_itab for example) using comma as below.
    TYPES: BEGIN OF ty_lines,
             line(1023) TYPE c,
           END OF ty_lines.
    DATA: l_filename TYPE string VALUE 'C:\temp\abcd.csv',
          gt_lines  TYPE TABLE OF ty_lines,
          gw_lines  TYPE ty_lines.
      LOOP AT gt_itab INTO gw_itab.
        CONCATENATE gw_itab-f1
                    gw_itab-f2 .....
               INTO gw_lines-line
               SEPARATED BY ','.
         APPEND gw_lines TO gt_lines.
      ENDLOOP.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = l_filename
          filetype                = 'ASC'
          confirm_overwrite       = 'X'
          no_auth_check           = 'X'
        TABLES
          data_tab                = gt_lines.

  • Dulicacy of field values in the CSV file

    Hi Experts
    We are configuring a file to idoc scenario in which the file is a .csv txt file.
    The format of the csv file is
    NMI,BillNo,BillAmount,ContractAcc
    There are instances where there is a duplicacy in the NMI & hence that needs to be filtered before sending it to PI.Any idea about how to filter this either at the source end or PI end.
    Please throw some light in this.
    Regards
    Sabyasachi

    Hi Sabyasachi,
    Manually you will need to open the file put it into excel remove duplicate entries , again move that back again into text file. This method is a very dumb way of doing things.
    A smarter way would be to write a module. The link given below is not a tailor made solution to your query but sufficient to get you started.
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/99593f86-0601-0010-059d-d2dd39dceaa0
    Regards
    joel

  • CCM 2.0: Field price unit in the csv file

    Hello Colleagues,
    We have SRM 5.5 with CCM 2.0
    We would like to know the name of the column field in the csv file to indicate the price unit. For example, we have articles that the price is 93€ / 1.000 Units. We would like to know the name of the field in the csv file to enter 1.000 and if it is necessary some customization in the SRM to activate this field.
    Thank-you.

    Hello Colleagues,
    We have SRM 5.5 with CCM 2.0
    We would like to know the name of the column field in the csv file to indicate the price unit. For example, we have articles that the price is 93€ / 1.000 Units. We would like to know the name of the field in the csv file to enter 1.000 and if it is necessary some customization in the SRM to activate this field.
    Thank-you.

  • Read the csv file from plsql

    Hi,
    I have data in csv file. I need to read the data from that file and at the same time i need to omit first row(ie column header). How can i do this...?
    Please help me....asap
    Thanks in advance....

    BluShadow wrote:
    Nuerni wrote:
    Just read-in the csv-file line by line and dismiss the first line; use a tokenizer for each line to get the semicolon-delimited field of every line; now fill your record/table or anything else with the tokens...
    There's an tokenizer-example in this forum I've posted recently:
    Re: Comma separated values to columns
    That's a lot of hard work to achieve something that is built into SQL*Loader and External Tables. All that's needed is the SKIP <n> keyword included in the control definition for those.You're right!
    If SQL*Loader and External Tables is an available option for SHAN01 then try use it; if not then I would consider the tokenizer-method...

  • Need to take a value from the csv file and query in a OAF page.

    Hello,
    I have a requirement to take the list of employee numbers in a csv file and display its corresponding job on the page.
    I have created a item 'MessageFileupload' where the user will upload the csv file containing the employee number and a Button 'Display Jobs' which will display the corresponding jobs on the page.
    Any idea how to take the values from the csv file and query it?
    Regards,
    den123.

    Hi ,
    Check
    http://oraclearea51.com/contribute/post-a-blog-article/csv-file-upload-for-oa-framework.html
    http://www.roseindia.net/jsp/upload-insert-csv.shtml
    Below code works from above blogs.
    package xx.oracle.apps.pa.Lab.webui;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    // import java.io.*;
    import oracle.apps.fnd.common.VersionInfo;
    import oracle.apps.fnd.framework.OAApplicationModule;
    import oracle.apps.fnd.framework.OAException;
    import oracle.apps.fnd.framework.server.OAViewObjectImpl;
    import oracle.apps.fnd.framework.webui.OAControllerImpl;
    import oracle.apps.fnd.framework.webui.OAPageContext;
    import oracle.apps.fnd.framework.webui.beans.OAWebBean;
    import oracle.jbo.domain.BlobDomain;
    import oracle.cabo.ui.data.DataObject;
    import oracle.jbo.Row;
    * Controller for ...
    public class deptCsvUploadCO extends OAControllerImpl
      public static final String RCS_ID="$Header$";
      public static final boolean RCS_ID_RECORDED =
            VersionInfo.recordClassVersion(RCS_ID, "%packagename%");
       * Layout and page setup logic for a region.
       * @param pageContext the current OA page context
       * @param webBean the web bean corresponding to the region
      public void processRequest(OAPageContext pageContext, OAWebBean webBean)
        super.processRequest(pageContext, webBean);
       * Procedure to handle form submissions for form elements in
       * a region.
       * @param pageContext the current OA page context
       * @param webBean the web bean corresponding to the region
      public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
        super.processFormRequest(pageContext, webBean);
        // Code Addition Started for CSV upload
        OAApplicationModule am = (OAApplicationModule) pageContext.getApplicationModule(webBean);
        OAViewObjectImpl vo = (OAViewObjectImpl) am.findViewObject("deptCsvVO1");
          //if ("GoBtn".equals(pageContext.getParameter(EVENT_PARAM)))
           if (pageContext.getParameter("GoBtn") != null)
          System.out.println("Button Pressed");
              DataObject fileUploadData =(DataObject)pageContext.getNamedDataObject("FileUploadItem");
              String fileName = null;
              String contentType = null;
              Long fileSize = null;
              Integer fileType = new Integer(6);
              BlobDomain uploadedByteStream = null;
              BufferedReader in = null;
                      try
                      fileName = (String)fileUploadData.selectValue(null, "UPLOAD_FILE_NAME");
                      contentType =(String)fileUploadData.selectValue(null, "UPLOAD_FILE_MIME_TYPE");
                      uploadedByteStream = (BlobDomain)fileUploadData.selectValue(null, fileName);
                      in = new BufferedReader(new InputStreamReader(uploadedByteStream.getBinaryStream()));
                      fileSize = new Long(uploadedByteStream.getLength());
                      System.out.println("fileSize"+fileSize);
                      catch(NullPointerException ex)
                      throw new OAException("Please Select a File to Upload", OAException.ERROR);
                      try{ 
                      //Open the CSV file for reading 
                      String lineReader=""; 
                      long t =0;
                      String[] linetext; 
                      while (((lineReader = in.readLine()) !=null) )
                      //Split the deliminated data and
                      if (lineReader.trim().length()>0)
                      System.out.println("lineReader"+lineReader.length());
                      linetext = lineReader.split(","); 
                      t++;
                      //Print the current line being
                      if (!vo.isPreparedForExecution())
                              vo.setMaxFetchSize(0);
                              vo.executeQuery();
                        System.out.println("Trimmed "+  linetext[1].replace("\"", ""));
                      Row row = vo.createRow();
                      row.setAttribute("Deptno", linetext[0].trim());
                      row.setAttribute("Dname",linetext[1].trim().replace("\"", ""));
                      row.setAttribute("Loc",linetext[2].trim().replace("\"", ""));
                      //row.setAttribute("Column4", linetext[3].trim());
                      vo.last();
                      vo.next();
                      vo.insertRow(row);
                      catch (IOException e)
                            throw new OAException(e.getMessage(),OAException.ERROR);
              //else if (pageContext.getParameter("Upload") != null)
              am.getTransaction().commit();
              throw new OAException("Uploaded SuccessFully",OAException.CONFIRMATION);     
    }Thanks,
    Jit

Maybe you are looking for

  • Reversal of a goods receipt for PO in EUR is differently valuated.

    Hi, Do you know how can i solve such problem: The return delivery or reversal of a goods receipt for a purchase order, scheduling agreement, or production order is valuated differently than the original goods receipt becouse system takes exchane rate

  • White space not preserved with XSL Mapping

    Hello Is there a problem with preserving white space when using a XSL mapping? My schema has the following included:               <xs:element name="FileVersion" minOccurs="1" maxOccurs="1">                 <xs:simpleType>                   <xs:restr

  • Macbook to new iMac

    New iMac:  do I really want to use time machine backup from macbook (which I will continue to use but has a lot of stuff on it I don't particularly want to move to the imac)??  Or is it better to move things manually and reload applications?

  • Adt code sign GateKeeper rejection for OS X AIR app

    I'm having a problem getting a signed OS X AIR captive runtime bundle app to pass the GateKeeper signature smell test. Here are the digestible facts, in list format: - App is multi-platform OS X, Windows, iOS, Android, but let's just focus on OS X fo

  • Screen Table ! Doubt!

    Hi!     In Screen Table whats the difference b'tween ACTIVE & INPUT    BOTH Seems to be input fields then what??    Thanks In Advance     Rahul.