Problem to insert  Chinese Characters(GB3212)  into MySQL

I met a problem to insert Chinese Characters (GB3212) into MySQL using Entity Bean (or JPA).
For example, when a hardcoded string "{color:#ff0000}电器me元件{color}" is inserted, it is displayed as "{color:#ff0000}??me??{color}" in MySQL.
The NamedQuery is also not working for Chinese Characters.
The setting are as following:
GlassFish JDBC connection pool: useUnicode=true, charecterEncoding=gb2312
NetBeans IDE: source encoding set to GB2312;
MySql table: the column set to CHARACTER SET gb2312;
Any experts, please give advice
Thanks lot

I didn't noticed that there is a {color:#ff0000}sun-resources.xml{color} file under {color:#ff0000}<ejb project>/server resources{color}.
This file has a pool configuration. This config just overwite the paremeter i added using Admin Console every time a client is lauched. So there are two option to fix this problem.
1. Insert the follwowing two lines into the {color:#ff0000}sun-resources.xml{color}
<property name="characterEncoding" value="gb2312"/>
<property name="useUnicode" value="true"/>
2. delete the everthing in the {color:#ff0000}sun-resources.xml, using Admin Console {color}config your own pool & DataSource
I tried first option & it works.

Similar Messages

  • Insert chinese characters in oracle81 database(with code here)

    Hi all,
    I have problem on insert chinese characters in oracle8i database(with code below). But no problem when display chinese characters in HTML( not include in the follow program)
    Can anyone help me?????
    In unix:
    Database setting:
    charset: ZHT16BIG5
    version:8.1.7
    In NT 4.0 with SP5:
    web/app server setting
    webserver: iWs4.0.1
    appserver: iAs6.0
    Java 1.2.2 with download classes12.zip/nls_charset12.zip
    JDBC thin driver
    code:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.sql.*;
    import javax.sql.*;
    import java.util.*;
    import java.lang.*;
    import java.lang.reflect.*;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import java.math.*;
    import oracle.sql.*;
    public class updatedata extends HttpServlet
    Connection dbCon = null;
    ResultSet rs = null;
    DataSource ds1 = null;
    String input_data = "";
    public void doGet(HttpServletRequest req, HttpServletResponse res)
         throws ServletException,IOException{
         input_data = req.getParameter("chinese_input");
    res.setContentType("text/html; charset=BIG5");
    PrintWriter out = res.getWriter();
    // draw a table
    ConnDB(out);
    DrawTable(out);
    public void JDBC(PrintWriter out) throws NamingException {
    InitialContext ctx = null;
    String dsName1 = null;
    Connection conn = null;
         dsName1 = "jdbc/project";
         try {
    ctx = new InitialContext();
    ds1 = (DataSource)ctx.lookup(dsName1);
         }catch (NamingException e) {
         out.println("exception in servlet in JDBC : " + e.toString());
    /** big5 to unicode conversion **/
    private String b2u(String str2convert)
         throws IOException {
         StringBuffer buffer = new StringBuffer();
         byte[] targetBytes = str2convert.getBytes();
         ByteArrayInputStream stream = new ByteArrayInputStream(targetBytes);
         InputStreamReader isr=new InputStreamReader(stream, "BIG5");
         Reader in = new BufferedReader(isr);
         int chInt;
         while ( (chInt = in.read()) > -1 ) {
              buffer.append((char)chInt);
         in.close();
         return buffer.toString();
    private void DrawTable(PrintWriter out){
    try{
         try{
         // update data
         String u="update test_chinese set chinese_script=? where prod_cd=?";
         String sProd = "T1";
         PreparedStatement ps = dbCon.prepareStatement(u);
         ps.setString(1, input_data);
         ps.setString(2, sProd);
         ps.executeUpdate();
         dbCon.commit();
         catch(SQLException e){
              out.println("exception in insert: " + e.toString());
    out.println("<html>");
    out.println("<body>");
    out.println("update success!!!!");
         out.println("</body>");
    out.println("</html>");
         catch(Exception e){
         out.println("exception in servlet in statement: " + e.toString());
    private Connection ConnDB(PrintWriter out){
         try{
         try{
              JDBC(out);
         catch (Exception e) {
              out.println("Database connect failed (init)");
              out.println(e.toString());
              return null;
         dbCon = ds1.getConnection();
         catch(Exception e){
         out.println("exception in servlet in connection: " + e.toString());
    return dbCon;
    public void destroy() {
    //Close database connection
    try {
    dbCon.close();
    catch (Exception e) {
    System.out.println("Error closing database (destroy)");
    System.out.println(e.toString());

    Hi, Jenny,
    When you said unable to insert to database, do you mean you get all ? marks in the database or garbage characters in the database?
    ? marks mean there are some byte chop off, and garbage characters mean the bytes are ok, just encoding problem.
    --Lichu                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Insert chinese characters to mysql

    I have searched the forum and found a useful links --http://forum.java.sun.com/thread.jspa?threadID=530358 about inserting chinese characters to mysql. However, I can't see the chinese characters displayed in the db. The charset and collation of my table are utf8 and utf8_bin respectively. Can anyone help me? Below is my source code
    ------------------ Servet ---------------------
    package test;
    import java.io.*;
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class testServlet extends HttpServlet {
    private Connection conn;
    public void init(ServletConfig config) throws ServletException {
         sSysPhyPath = config.getServletContext().getRealPath("/");
    public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException
         // set content type and other response header fields first
         res.setContentType("text/html");
         // get the communication channel with the requesting client
    PrintWriter out = res.getWriter();
    out.println("<html>");
    out.println("<body bgcolor=\"white\">");
    out.println("<body>");
         req.setCharacterEncoding("UTF-8");
         sValue = req.getParameter("s1");
         out.println(sValue.getBytes("UTF-8") + "<br>");
         DBConnection objConn = new DBConnection(sSysPhyPath);
         try {
              conn = objConn.get();
              objConn.execQuery(conn, "insert into TBL_test (test_desc) values ('" + sValue.getBytes("UTF-8") + "')");
         catch(Exception e) {
              e.printStackTrace();
         objConn.closeConnection(conn);
    out.println("</body></html>");
    public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException
    doGet(req, res);
    public void destroy() {
    --------------- Html ------------------
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Test</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    </head>
    <body bgcolor="#666666">
    <form name="test" method="post" action="testServlet">
    <input type="text" name="s1">
    <input type="Submit" name="Submit" value="Submit">
    </form>
    </body>
    </html>
    Besides, if I code the chinese characters directly in the servlet page, what is the encoding of the chinese characters by default? Is it related to my OS locale?
    Thanks a lot.

    objConn.execQuery(conn, "insert into TBL_test
    st (test_desc) values ('" + sValue.getBytes("UTF-8")
    + "')");You would be better off using a PreparedStatement and parameters. This will let the MySQL JDBC driver take care of the required encoding.

  • Problems in displaying chinese characters with utf-8 encoding

    Hi,
    I got problem in displaying chinese characters in my web application.
    I am creating a web application supporting both English and Chinese charaters. What I am trying to do is:
    1. storing some chinese characters via a web page (page1) into database.
    2. retrieve the chinese characters via another web page (page2) from the database.
    Once I put the Chinese characters on the webpage (page1 in step #1), it displayes well (the readable chinese characters) before I submit this page (after submit, the data will be stored into the database).
    But when I tried to display the chiese characters via page2 in step#2, I got un-readable characters displayed.
    The running configuration is: Sun Application Server (coming and with the JSC2) and MySQL server 5.0. And I setup the database server with utf8 as character-set.
    It seems like the chinese characters got messed up throught the round-trip (from page1<----via jdbc---->database<----via jdbc------>page2).
    From the database, I found the chinese characters are there. Any helps are appreciated.

    Hi,
    I am trying to insert new record.The record may contain chineese or English data.
    I did same what u specified.
    first I converted to the byte UTF8.again,I converted byte to string using 8859_1.
    the values are not storing chinese characters.
    pls suggest me.
    below is my code.
                                  ascCode = req.getParameter("asccode");
                                  countryCode = req.getParameter("countrycode");
                                  ascName      = req.getParameter("ascname");
                                  address1     = req.getParameter("ascaddress1");
                                  address2 = req.getParameter("ascaddress2");
                                  System.out.println("ASC NAME:"+ascName);
                                  System.out.println("ADDRESS1:"+address1);
                                  System.out.println("ADDRESS2:"+address2);
                                  ascC = ascCode.getBytes("UTF8");
                                  coun = countryCode.getBytes("UTF8");
                                  ascN           = ascName.getBytes("UTF8");
                                  add1 = address1.getBytes("UTF8");
                                  add2          = address2.getBytes("UTF8");
                                  System.out.println("ASC NAME:"+ascN);
                                  System.out.println("ADDRESS1:"+add1);
                                  System.out.println("ADDRESS2:"+add2);
                                  ascCode = new String(ascC,"8859_1");
                                  countryCode= new String(coun,"8859_1");
                                  ascName = new String(ascN,"8859_1");
                                  address1 = new String(add1,"8859_1");
                                  address2 = new String(add2,"8859_1");
                                  System.out.println("ASC NAME:"+ascName);
                                  System.out.println("ADDRESS1:"+address1);
                                  System.out.println("ADDRESS2:"+address2);
    thanks.

  • How to insert chinese characters in a table use FDK?

    Hello~~
    I am expecting to insert chinese characters in an XML file's table.
    I'm using FDK7.2,  if i use:
    F_ApiAddText(docId, &tRange.beg, "asdf");
    The English letters "asdf" can be insert correctly in the right place,
    But,  if insert chinese characters like this:
    F_ApiAddText(docId, &tRange.beg, "人们");
    No characters insert.
    How can i solve this problem?
    Please advise
    Thanks
    zhaopeng

    Zhaopeng,
    Which encoding are you using for the Chinese characters? FrameMaker 7.2 does not support Unicode or UTF-8. I have not done this before, but I guess you need to supply the characters in Big5 resp. GBK encoding, see
    http://help.adobe.com/en_US/FrameMaker/8.0/chinese_korean.pdf
    [Ignore the 8.0 in the URL, the document talks about FrameMaker 7]
    You also may have to make sure the paragraph format at your text location uses a Chinese font before inserting characters.
    - Michael

  • How to Insert  Chinese characters in Japanese Database

    Hi all,
    I am having following characteristics on my computer
    Machine OS --Windows Server 2003
    OS language --Japanese
    Oracle
    Oracle9i Release 9.2.0.1.0 - Production
    NLS_LANGUAGE     JAPANESE
    NLS_CHARACTERSET     JA16SJIS
    Now, i want to insert into database chinese characters. Please guide me how to do the following thing.
    How to insert chinese characters on local machine and if i want to insert on the remote databse (i can not create database link for remote database). I have to send batch file or SQL file and they will execute it on their side.
    if i use this command
    alter session set nls_language = "SIMPLIFIED CHINESE"
    and then insert the records and revert back to japanese character set. Is this correct way....?
    Thanks in advance,
    Pal

    As dombrooks has pointed out, unless all the Chinese characters you are trying to store can be represented in the Shift-JIS character set, which seems unlikely, but I'm not an expert on East Asian languages and I believe there are some glyphs that are shared between various languages, then you're not going to be able to store this data in this database in CHAR or VARCHAR2 columns.
    Depending on the national character set, you may be able to store the data in NCHAR/ NVARCHAR2 columns, though using these data types can substantially increase application complexities since various languages and libraries don't support NCHAR/ NVARCHAR2 columns or require you to jump through some hoops to use them. Your applications would also have to support both character sets, so your applications would all have to be Unicode enabled most likely, which is certainly possible but it may not be a trivial change.
    Justin

  • Problem while inserting Latin characters

    Hi All,
    Version details
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE    10.2.0.4.0      Production
    TNS for Solaris: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - ProductionLanguage :
    SQL> show parameter nls_lang
    NAME                                 TYPE        VALUE
    nls_language                         string      AMERICANCurrently,we are facing problem in inserting Latin characters such as 'ʬ '
    We are receiving these characters from another DB via DB Link .What parameters should I change in my DB to accept those Latin characters.
    Please suggest an approach or charset that'll allow my Db to accept both English and Latin characters.

    Sorry for not providing exact information.But please consider the example character that I've mentioned 'ʬ'.
    While I'm trying to insert the above character in my Db with below nls_parameters
    SQL>  select parameter||'--> '||value from nls_database_parameters;
    PARAMETER||'-->'||VALUE
    NLS_LANGUAGE--> AMERICAN
    NLS_TERRITORY--> AMERICA
    NLS_CURRENCY--> $
    NLS_ISO_CURRENCY--> AMERICA
    NLS_NUMERIC_CHARACTERS--> .,
    NLS_CHARACTERSET--> UTF8
    NLS_CALENDAR--> GREGORIAN
    NLS_DATE_FORMAT--> DD-MON-RR
    NLS_DATE_LANGUAGE--> AMERICAN
    NLS_SORT--> BINARY
    NLS_TIME_FORMAT--> HH.MI.SSXFF AM
    PARAMETER||'-->'||VALUE
    NLS_TIMESTAMP_FORMAT--> DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT--> HH.MI.SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT--> DD-MON-RR HH.MI.SSXFF AM TZR
    NLS_DUAL_CURRENCY--> $
    NLS_COMP--> BINARY
    NLS_LENGTH_SEMANTICS--> BYTE
    NLS_NCHAR_CONV_EXCP--> FALSE
    NLS_NCHAR_CHARACTERSET--> AL16UTF16
    NLS_RDBMS_VERSION--> 10.2.0.4.0
    20 rows selected.My Table
    create table r_dummy (a varchar2(4000))
    /Insert Script
    insert into r_dummy values('ʬ' )But after inserting
    When I retrieve the inserted data
    SQL> select *
      2  from r_dummy;
    A
    ?Please lemme know how to insert the above character.

  • Unable to insert Chinese characters in Database

    My problem is that I am not able to insert chinese
    (to traditional chinese) characters into my tables in the
    database.
    I have changed the character set to UTF8 while creating the
    database and also tried the alter session command in SQL to
    alter the NLS_LANGUAGE and NLS_TERRITORY (to say traditional chinese).
    But this did not solve my problem.
    Also tried all possibilites like getting Chinese characters
    in my notepad by copy - paste from a Chinese web site
    but while giving the insert into command in my database
    it takes some junk values.
    Someone PLEASE HELP!!!URGENT!!!
    Thanks in advance.
    RKP
    null

    You mentioned in your first note that you have set your database character set to UTF-8? If so, then you are able to store and retrieve multilingual data, including Chinese and Japanese characters. Your issue is not the database. Your client OS must be able to support these languages as well. It is likely that your version of OS supports only Latin and Western European characters. By the way changing your NT regional setting only effects sorting, date formats etc. It doesn't help you change the languages that your keyboard will support.
    1.To determine your Win32 operating system's current ANSI CodePage (ACP). This can be found by bringing up the registry editor (Start --> Run..., type "regedit.exe", and click "OK") and looking at the
    registry entry HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage\ACP (there are many registry entries with very similar names, so please make sure that you are looking at the right place in the registry).
    2.To find the character set in the table below based on the ACP you got above.
    ANSI CodePage (ACP) Client character set (3rd part of NLS_LANG) (*1)
    1250 EE8MSWIN1250
    1251 CL8MSWIN1251
    1252 WE8MSWIN1252
    1253 EL8MSWIN1253
    1254 TR8MSWIN1254
    1255 IW8MSWIN1255
    1256 AR8MSWIN1256
    1257 BLT8MSWIN1257
    1258 VN8MSWIN1258
    874 TH8TISASCII
    932 JA16SJIS
    936 ZHS16GBK
    949 KO16MSWIN949
    950 ZHT16MSWIN950
    others UTF8 (*2)
    (*1) The character sets listed here are compatible with Win32's non-Unicode graphical user interface (GUI). Since Win32's MSDOS Box (Command Prompt) uses different character sets, NLS_LANG needs to be manually set in the MSDOS Box (or set in a batch script) in order to handle the difference
    between Win32's GUI and MSDOS Box. (Please see "NLS_LANG Settings in MS-DOS Mode and Batch Mode" in the Oracle8i Installation Guide Release 2 (8.1.6) for Windows NT, part# A73010-01.)
    (*2) If you use UTF8 for the 3rd part of NLS_LANG on Win32, client programs that you can use on this operating system would be limited to the ones that explicitly support this configuration. Recent versions of Oracle Forms' Client/Server mode (Fat-Client) on NT4.0 would be an example of such client
    programs. This is because the user interface of Win32 is not UTF8, therefore the client programs have to perform explicit conversions between UTF8 (used in Oracle side) and UTF16 (used in Win32 side).

  • INSERTing chinese characters in SQL*plus

    Db version: 10gR2
    NLS_NCHAR_CHARACTERSET for my DB is AL16UTF16 by which i can store chinese characters. To INSERT using SQL*Plus, i tried to copy and paste some chinese characters from internet. When the characters get pasted, it becomes '?????' (question marks). What else do i have to set to store Chinese characters?
    SQL>  CREATE TABLE EMP2
      2   (EMPNO NUMBER,
      3   ENAME NVARCHAR2(500));
    Table created.
    SQL> Insert into emp2(empno,ename) values(889,UNISTR('????'));
    1 row created.
    SQL> COMMIT;
    Commit complete.
    SQL> SELECT * FROM EMP2;
         EMPNO ENAME
           889 ????

    Actually, it looks like Forums do something strange to URLs pasted into posts. Sorry!
    The thread URL is Re: store/retrieve data in lang other than eng when CHARACTERSET is not UTF8

  • Inserting chinese characters

    hi
    I have my Database with UTF-8 characterset.
    I have sql file that contains data in chinese characters.
    I need to run this sql and insert data into my database tables.
    The sql file is simple text file saved in UTF-8 encoding.
    Do I need to install chinese font on my machine to be able to run the sql successfully?
    My nls_lang setting is AMERICAN_AMERICA.UTF8.
    kelvin

    What is your operating system characterset? What is your database's operating system? What version of Oracle do you use?

  • Problem in displaying chinese characters in chinese OS

    I have a application that is supposed to run on chinese OS. But i can't seem to make it display in the correct language format, whether its big5 or gb2312.
    When saving chinese characters to db, it saves weird characters to the db and retreive the weird characters to be displayed on the web.
    Do I need to do any changes to anything ??
    Thank you in advance.
    current system requirements:
    Chinese OS (NT4)
    Access DB (English version)
    Java / JSP languages
    Display big5 or GB2312

    Try using varchar

  • How to insert a bean variable into MySql using jsp

    Hi, I have a problem that I have been trying to work out for ages..unsuccessfully.
    My web-site takes 2 inputs off a user...does a calculation on them and returns the result to the user.
    I want to then use another jsp page that will take this result and insert it into a database...
    My class code for this is :
    public void updateRepmax(String userName, String repmax) throws SQLException, Exception{
         if(con != null){
         try{
         PreparedStatement update;
         update = con.prepareStatement("UPDATE repmax SET Benchpress = ?, WHERE Member_Name = ?");
         update.setString(1, repmax);
         update.setString(2, userName);
         update.execute();
         } catch(SQLException sqle){
         error = "SQLException: could not update repmax";
         throw new SQLException(error);
         catch(Exception e){
         error = "An exception occured while updating repmax";
         throw new Exception(error);
         } else {
         error = "Exception: connection to database was lost";
         throw new Exception(error);
    My JSP is :
    <%@page import="java.sql.*, placement.*"%>
    <jsp:useBean id="conn" class="placement.DBConnect" />
    <jsp:useBean id="query" class="placement.DBQuery" />
    <jsp:useBean id="bpcalc" class="placement.repmaxBean" />
    <jsp:useBean id="userin" class="placement.User" />
    <html>
    <head><title>Update Repmax</title></head>
    <body>
    <%
    conn.connect();
         String repmax = bpcalc.getRepmax();
         String userName = userin.getUserName();
    query.setCon(conn.getCon());
         query.updateRepmax();
    conn.disconnect();
    %>
         </body>
         </html>
    The variable I am tryin to insert is repmax ,in the class that does the calculation the repmax is a double so I assume that is my first problem(how can this be changed to allow it to insert?)....any help you have to offer would be greatly appreciated... 

    Thanks for your reply sathishkb,
    I am not actually receiving any error message,
    The jsp page is processed and the code seems to be correct however the table in my mysql database is not updated.. my JDBC drivers are working correctly etc.
    I expect that the problem is in my JSP page but dont know what it is
    I have removed that comma in my update statement
    I no longer have the problem of the variable being of type touble as I altered my other code to convert the variable from double to string
    jsp is now:
    <%@page contentType="text/html"%>
    <%@page import="java.sql.*, placement.*"%>
    <jsp:useBean id="conn" class="placement.DBConnect" />
    <jsp:useBean id="update" class="placement.DBQuery" />
    <jsp:useBean id="bpcalc" class="placement.repmaxBean" />
    <jsp:useBean id="currentuser" class="placement.currentuserBean" />
    <html>
    <head><title>Insert Into Repmax</title></head>
    <body>
    <%
    String repmax = bpcalc.repmax;
    String userName =currentuser.name;
    conn.connect();
         update.setCon(conn.getCon());
         update.updateRepmax(repmax,Username);
    conn.disconnect();
    %>
         </body>
         </html>
    the segment of my bean code is :
    public void updateRepmax(String repmax,String userName) throws SQLException, Exception{
         if(con != null){
         try{
         PreparedStatement update;
         update = con.prepareStatement("UPDATE repmax set Benchpress = ? WHERE Member_Name= ?");
         update.setString(1,repmax);
         update.setString(2,userName);
         update.execute();
         } catch(SQLException sqle){
         error = "SQLException: could not update employer";
         throw new SQLException(error);
         catch(Exception e){
         error = "An exception occured while updating employer";
         throw new Exception(error);
         } else {
         error = "Exception: connection to database was lost";
         throw new Exception(error);
    }

  • Encoding or font problem? Simplified Chinese characters

    Would be great if someone could help!
    I don't know much about Dreamweaver but trying to use it to create an invitation in Chinese. I tried to edit a template I used for an English invitation. But when I preview it in IE, some characters become weird but some are fine. I tried to use different fonts to test, and set different encoding from Edit > Preference. But nothing really changes. I have attached the file in IE. Anyone knows what's wrong?
    Thanks a ton!
    Winnie

    wwy1021 wrote:
    Would be great if someone could help!
    I don't know much about Dreamweaver but trying to use it to create an invitation in Chinese. I tried to edit a template I used for an English invitation. But when I preview it in IE, some characters become weird but some are fine. I tried to use different fonts to test, and set different encoding from Edit > Preference. But nothing really changes. I have attached the file in IE. Anyone knows what's wrong?
    Thanks a ton!
    Winnie
    The only help I can offer is a post made by David Powers to a similar question some time ago:
    Change the page encoding. Modify > Page properties > Encoding. Depending 
    on the type of Chinese, choose Chinese Traditional (normally used in 
    Taiwan and Hong Kong) and Chinese Simplified (used in the People's 
    Republic).

  • Problem in Inserting the new values into Ztable

    Hi Techies,
    I have a requirement that when ever user enters the value in Billing Qty input which is in VF01 tcode and the table is VBRP-FKIMG, and client want billing qty and previous month reading, the fields are not in VBRP. So I have created a custom table name as YSD-EXPORT_QTY with fields of CUSTOMER, MONTH, YEAR, BILL_QTY, PREV_READING, CUMULATIVE... When ever user enter the Billing Qty I want to update database table and initally there is no data in custom table. I tried below code but i am not getting and i am getting the error as
    "The type of the database table and work area (or internal table) "WA_EXPORT" are not Unicode convertible. "
    So, How can I resolve this issue.. I am trying this since from 3 days... if u have any sample code please give me...
    MOVE WA_VBRP-FKIMG TO WA_EXPORT-BILL_QTY.
    WA_EXPORT-CUMULATIVE = WA_EXPORT-BILL_QTY + WA_EXPORT-PREV_READING.
    WA_EXPORT-PREV_READING = WA_EXPORT-CUMULATIVE.
    APPEND WA_EXPORT TO IT_EXPORT.
    INSERT INTO YSD_EXPORT_QTY VALUES WA_EXPORT.

    If it overrides existting record, you should add new key fields to your database table, there can be only one record per set of key values.
    I suppose  keys look like MANDT, KUNNR, GJAHR, MONAT or MANDT VBELN POSNR or a combination of both set of keys (not sure to understand you requirement)
    You have to first read from database if some data already exists,
    - if yes, add the new quantities and UPDATE the record
    - if no, INSERT a new record
    Remember keys define a unique record, and cannot be updated once inserted.
    If your program should never update records, add a "technical" key field, and fill it using a timestamp or a number range counter (FM NUMBER_GET_NEXT)
    Regards,
    Raymond

  • Problem in printing Chinese characters by using JavaPrintService

    Hi, I just develop a tool to print txt files by using Java Print Service.
    Everything seems to be good, but when the file contains Chinese character, it can't be print correctly.
    I tried to use the DocFlavor.Reader and DocFlavor.STRING, however all of them are failed.
    My code is below, please help me, thanks so much
    PrintRequestAttributeSet pars = new HashPrintRequestAttributeSet();
    // TODO:Printing is not correct because of the Chinese Encoding
    DocFlavor flavor = new DocFlavor.INPUT_STREAM("text/plain;charset=UTF-8");//DocFlavor.INPUT_STREAM.AUTOSENSE;
    PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService();
    if(defaultService != null){
    Iterator<String> it = filename.iterator();
    while(it.hasNext()){
    shortname = it.next().toString();
    abstractPath = GlobalVar.SRC_DIRECTORY_PATH + shortname;
    File file = new File(abstractPath);
    if(file.exists()){
    try{
    DocPrintJob job = defaultService.createPrintJob();
    FileInputStream fis = new FileInputStream(file);
    //BufferedReader br = new BufferedReader(new InputStreamReader(fis,"UTF-8"));
    DocAttributeSet das = new HashDocAttributeSet();
    Doc doc = new SimpleDoc(fis,flavor,das);
    job.print(doc, pars);
    }catch(PrintException ex){
    Log.doLog("Print failed\t" + shortname, Log.ERROR);
    System.out.println(ex.fillInStackTrace());
    }else{
    Log.doLog("File can't be found: "+abstractPath, Log.ERROR);
    }else{
    Log.doLog("Can't find printer", Log.ERROR);
    }

    Everything seems to be good, but when the file contains Chinese character, it can't be print correctly.And how exactly did you determine that the character set in that file is UTF8?

Maybe you are looking for

  • Tax code does not show in Drop Down while Creating SC

    Hi all, While creating Shopping Cart Tax code drop down only display Taxable. This Taxable we have made as default in the configuration. We have same configuration transported from our Development box to Quality box. In Development box Requestor can

  • Access Denied Error when using Bluetooth c#

    Hello, I am getting an error in my Bluetooth app: Access is denied (exception from HRESULT: 0x80070005(E_ACCESSDENIED)) This error occurs during a search for peers. It gets thrown once but then if you run the method to search for peers again it succe

  • How how to escape double quation in execute immediate in trigger

    Hi all, please inform me what is the mistake in this procedure. i think the problem in how to escape double quation. SQL> create or replace procedure P2 2 is 3 begin 4 execute immediate ' create or replace trigger t2 ' 5 ||' before insert ' 6 ||' on

  • Since mountain lion my MBP won't import RAW or jpg files

    my MBP won't import RAW or jpg files.  Worked fine before.  Could it be Mountain Lion?

  • Need a transparent background in InDesign

    I am creating a window cling and need the background to be transparent. I drew a rectangle and left the stroke at 100 percent and reduced the fill to 0 percent, effectively making the inside to be transparent. It does not show on the InDesign documen