How to store and retrieve chinese characters

Hi, I am facing some problem in storing and retrieving of chinese characters from oracle,9i .
This is the character i am trying to store into the database
自动提款机网络
while trying to retrieve it, it shows
自?提款机网?
^ ^
you can see the weird characters like ? at some places.
here is the sample code which i can using to store and retrieve data from the database
class testInsert
public static void main(String[] args)
try {
     DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
     Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@172.16.6.81:1521:JFPPTDB1", "citi_user", "citi_user");
     int employee_id = 12345;
String ename = "自动提款机网络";
     oracle.jdbc.OraclePreparedStatement pstmt = (oracle.jdbc.OraclePreparedStatement)conn.prepareStatement("INSERT INTO employees (employee_id, last_name) VALUES (?, ?)");
     pstmt.setFormOfUse(2, oracle.jdbc.OraclePreparedStatement.FORM_NCHAR);
     pstmt.setInt(1, employee_id);
     pstmt.setString(2, ename);
     pstmt.execute();
pstmt.close();
pstmt = (oracle.jdbc.OraclePreparedStatement)conn.prepareStatement("SELECT last_name, employee_id from employees");
ResultSet rset = pstmt.executeQuery();
          String name = "";
          while(rset.next())
               name = rset.getString(1);
     int id = rset.getInt(2);
          System.out.println("the name is :"+name);
catch (SQLException sqe)
          System.out.println("Java SQLException caught, error message="+sqe.getMessage());
and the table in oracle is
SQL> desc employees;
Name Null? Type
LAST_NAME NVARCHAR2(10)
EMPLOYEE_ID NUMBER
I am using classes12.zip for oracle,9i. Is there any database setting that i need to know to retrieve the chinese characters?.
I have been facing this problem for quite sometime and it makes my life tough. Please help me in solving this issue.
Thanks
PD

hi, can you retrieve the chinese character from your os? When it comes to the wild code of asian character, you should focus on the database/client character setting. you may ask more about it from your dba.
have a nice weekend!
eilison
[email protected]

Similar Messages

  • How to store and retrieve blob data type in/from oracle database using JSP

    how to store and retrieve blob data type in/from oracle database using JSP and not using servlet
    thanks

    JSP? Why?
    start here: [http://java.sun.com/developer/onlineTraining/JSPIntro/contents.html]

  • LRv3.2 Networking with an Asst , How to store and retrieve updated work on Win7?

    LRv3.2 Networking with an Asst , How to store and retrieve updated work on Win7 Network?
    We have a working 1gig network in Win7 PRO 64-bit.  and using LRv3.2
    * How do I configure our Files or Cataloges "so"  ALL Edits are veiwable/edit to all?   (we don't work on the Same Shoot/Folder at the same time)
    I NEED to see,  ALL the LR  Edits  (is great with DNG files
    *** BUT,  what I cannot see if I remember correctly (with just the DNG sharing)  is the  CROP or Virtual Copys ... possibly the Brush edits.
    HOW, do I configure to be able to read and edit ...  ALL of the updated/saved  Edits???   (after it is done by my asst.)
    Is creating a New Catalog for EACH  shoot the way to go?   (not sure I like this idea)
    Right now everything is in one(1) catalog  ... and it's getting big ... BUT, this allows us to search , and group ... going way back.
    Would be nice to be able to still do this easily, and with what we have already done.
    With our one BIG Catalog ... not sure if two(2) can access this catalog over the Network at the same time?
    Even though we never Edit the Same Folder or Files at the same time.
    Or will that be a problem over a simple Win7 PRO network?
    Thank you,
    HG

    Aloha Bob,
    Saw your link.  thank you.
    At least I don't feel "alone"  LOL
    At this point ... I am looking for a  "cluncky"   Work Around?
    * I was thinking,  Maybe making a copy of  My Cataloge ...
    Deleting ALL the  Folders in LR  ... except for the one's  that  will be worked by the Asst.
    Then moving that file to the  Asst.  Computer.
    * NEXT,  pointing the  Folder that they are working on ... across the Network to the Servers Files.
    * After they work on it:
    *** IS THERE A WAY ...
    * To  take that Cataloge ... and UPDATE  my Main  Cataloge.
    THIS, is the STEP  ... I don't know how to do.
    Can someone Help me with this?
    Step by Step,  because I am clueless ....
    Talking UPDATE of everything worked on ... including   Virtual copys, and  CROPS.
    Thank you,
    HG

  • How the store and retrieval in ServletContext will happen??

    Hello Sir,
    I am developing a chat application thats in Swing & servlets Now I am able to authenticate user and I am using ArrayList to maintain the names of the user globally my storing it in ServletContext
    How to store and retrieve ArrayList from Servletcontext
    And another thing is that we are having personal chat(1-to-1) also. But how to use the thread model is not known to us as we have not faced such a situation before
    So if you could suggest some example code or snippets ot certain links then it would be of great help to us
    Thanks
    Regards
    Monarch

    Hello
    thanks for your reply. Actually we are doing the same thing that u have mentioned in your reply.
    The thing we are trying to do is that when a user is logged in the particular servlet which is responsible for the authentiacation of the user will authenticate the user an then calls method in the Chatter class which is outside the servlet
    The Chatter class declares two mwthods addChatter() and getChatter()
    I am managing the currently logged users in Arraylist using this two mehtods above
    When the first user logs in his entry gets stored at the first position in the arraylist but when other user logs in then his entry overrites the entry of the first user instead of getting stored in the next position.
    The arraylist gets initialized when second user logs in. to overcome this problem i want to store the arraylist into the ServletContext so it will be unique for the whole application and will not get initialized
    So I want to know the process of storing and retrieving the arraylist fro the context
    Hope ull understand me and reply me
    Thanks
    Regards
    Monarch

  • How to store and retrieve XML messages in AQ using ESB/ BPE

    Hello,
    I am having a requirement which I feel should be fairly common - store and retrieve XML messages in AQ. However, I am struggling to decide which type of queue to use AQ or JMS...Here is the requirement
    1. In an ESB, I want to read different kind of files using file adapter. Different kind as in, having different structure or schema
    2. I want to create a queue that is capable of storing any kind of xml data. To this queue, I want to enqueue the message read in step 1.
    3. In another process, say a BPEL, I want to dequeue the message and write into a file. The filename is retrieved from one of the header properties. I want to dequeue using a stored procedure, not by using a JMS or AQ Adapter (reason being that these adapters poll the queue, and consume a message immediately. However, I want to consume the message only when there is a business need)
    My questions are:
    1. What kind of queue I should create in the DB (What should be its payload type...XMLType? )... I guess the answer would also determine the adapter to be used - JMS or AQ
    2. How I should map the xml data read from the file in step 1 to this adapter
    Any help is highly appreciated.

    You are right in suggesting that I dont need to store my XML data as xml in the DB...I dont want to too :) but its just that, thats the only option I can see at this time (the other track i am exploring is :
    File adapter(XML) -> Convert to opaque (base64binary) -> Enqueue opaque to JMS (aq$_jms_bytes_message) ->Dequeue Opaque -> Write file opaquely.
    In this I have hit the roadblock in trying to convert XML to base64binary...maybe some custom java function is needed...anyway)
    Coming back to this thread, where I am trying the following
    File adapter(XML)  -> Enqueue as XML to queue  ->Dequeue XML -> Write file opaquely.
    PS: I think its important for me to mention that I am using SOA 10.1.3.1.0
    I tried the steps you gave...after creating the queue, I am trying to create a JMS adapter. But the queue I created doesnt show up in the browse window of destinations for the JMS Adapter..That had led me to infer that JMS adapter cant be used
    {color:#99cc00}CREATE OR REPLACE TYPE batchupdate_row_type AS OBJECT
    (update_queue_id NUMBER
    ,upc VARCHAR2(20)
    ,price1 NUMBER);
    {color}
    {color:#99cc00}CREATE OR REPLACE TYPE batchupdate_rec_type AS VARRAY(9999999) OF batchupdate_row_type;
    CREATE OR REPLACE TYPE payload_type AS OBJECT ( payload batchupdate_rec_type);
    EXECUTE DBMS_AQADM.CREATE_QUEUE_TABLE ( queue_table => 'jmsuser.batch_update_queue_table', queue_payload_type => 'payload_type');
    EXECUTE DBMS_AQADM.CREATE_QUEUE ( queue_name => 'batch_update_queue', queue_table => 'jmsuser.batch_update_queue_table');
    EXECUTE DBMS_AQADM.START_QUEUE ( queue_name => 'batch_update_queue'); {color}
    I also needed some opinion on whether the last step of my proposed solution ( Dequeue XML -> Write file opaquely) is possible. As I want to develop a service oblivious of the structure of the file, I dont want to create a file adapter based on a particular xsd...so I want to write whatever xml I am getting from the queue....is this step possible

  • How to store and retrieve images from database...

    Hi All
    Anubody tell me plz how to store images in database using jsp.
    and how to retrieve tme.
    Plz reply...
    Anurag

    Exactly
    try the links below may be those might help u in store and retrieval any kind of file.
    http://www.mysqltalk.org/insert-blob-example-vt112861.html
    https://java.sun.com/j2se/1.5.0/docs/guide/jdbc/blob.html
    http://javaalmanac.com/egs/java.sql/GetBlob.html
    http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp?topic=/com.ibm.jdbc.doc/jdbc142.htm
    and a dearly advice friend please query google b4 you post any query out here.

  • IPhone - How to store and retrieve lots of video?

    Hi all,
    What is the best way (from a software design point of view) of storing and retrieving an arbitrary number of videos within an app?
    As an example, say there exists 100 videos. How would I store those videos and how to reference each one? Hard coding them into the app seems the wrong way.
    I'm not sure if I'm thinking along the right lines, but maybe some kind of file which can be read in containing the file names?
    The videos would be bundled along with the app.
    Thanks for your assistance.

    Bundle the video files as a folder within the application resources bundle. You can then list the contents of the folder which will contain only your video files. If you want additional metadata associated with each video, then you will need some kind of accompanying data - plist, text file etc.

  • How to store and retrieve a PDF form to SQL Server from LiveCycle?

    My intention is to save a complete PDF form into a database and then later on retrieve this form from DB.
    To do this, SQL Server has got two datatypes, image or Varbinary(max). I am able to store a PDF using "Execute SQL Statement"(I have written an Insert statement). Some value is being written into DB as well.
    But when I try to retrieve this record using "Query Single Row"(I store the result to a doc variable), the retrieved PDF is of an unknown type and cannot be opened by Adobe Reader.
    I am not sure if my approach is correct. Is it possible to store/retrieve a PDF form to/from a DB through LiveCycle?
    If yes, please give me some guidance.

    hi
    am not sure
    but u can use the same concept as storing image in db and retrieve..
    create a blob column
    parse that pdf and store into that column.
    again u retrieve the content and via file io make the same name with pdf extension..

  • How to store and retrieve image in a MsAccess DB using JDBC

    I want to store images in a MsAccess DB using JDBC and also want retrieve them from DB. please don't tell to store the path of image..I want to store the image not the path...pls reply..thanx in advance

    zakircse, you should read more about Java's API.
    import java.io.*;
    import java.sql.*;
    import java.util.Properties;
    import java.awt.*;
    import javax.swing.*;
    public class ImageDemo{
    public static void main(String argv[]){
    try{
    String url="jdbc:access:/c:/test";
    Class.forName("com.hxtt.sql.access.AccessDriver").newInstance();
    Properties properties=new Properties();
    Connection connection = DriverManager.getConnection(url,properties);
    Statement stmt = connection.createStatement();
    stmt.execute("create database if not exists imagedatabase;");
    connection.setCatalog("imagedatabase.mdb");
    stmt.execute("create table if not exists imagetable (imageid int,IMAGE_DATA blob);");
    File file=new File("c:/pic.jpg");
    FileInputStream in=new FileInputStream(file);
    PreparedStatement ps=connection.prepareStatement("insert into imagetable (imageid,IMAGE_DATA) values(?,?);");
    ps.setInt(1,1234);
    ps.setBinaryStream(2,in,(int)file.length());
    ps.execute();
    ps.close();
    ResultSet rs =stmt.executeQuery("select IMAGE_DATA from imagetable where imageid=1234");
    byte[] imgbytes=null;
    if(rs.next()) {
    imgbytes=rs.getBytes(1);
    rs.close();
    stmt.close();
    connection.close();
    if(imgbytes!=null){
    JFrame fr = new JFrame();
    fr.setTitle("Simple Demo for Load Image from MS Access");
    Image image = fr.getToolkit().createImage(imgbytes);
    fr.getContentPane().add(new PaintPanel(image));
    fr.setSize(200,400);
    fr.setVisible(true);
    Thread.sleep(10000);
    System.exit(0);
    catch( SQLException sqle )
    do
    System.out.println(sqle.getMessage());
    System.out.println("Error Code:"+sqle.getErrorCode());
    System.out.println("SQL State:"+sqle.getSQLState());
    sqle.printStackTrace();
    }while((sqle=sqle.getNextException())!=null);
    catch( Exception e )
    System.out.println(e.getMessage());
    e.printStackTrace();
    class PaintPanel extends JPanel {
    private Image image;
    public PaintPanel(Image image) {
    this.image = image;
    public void paintComponent(Graphics g) {
    super.paintComponent(g);
    g.drawImage(image, 0, 0, this);
    }

  • How to store and retrieve clob data fields

    Hai al l,
    How to sotre resumes of a Jobseekers in Oracle Data Base.Which version is enough(8i or 9i) and CLOB or BLOB is Preferable.
    Now my requirement is to insert the all the Attachments into Oracle database. I have little bit knowledge on inserting image file into DB. Now I want to insert More than 1000000 resume Attachments (all are .doc or .rtf files).Can you suggest me on this with a sample program .I am really thankful to all of our Members support and Valuable doubt clarifications.
    I am waiting for your valueble reply
    thanks in advance
    Kanchnaa
    I am really thankful for your support and Valuable doubt clarifications.

    CLOBs and BLOBs are physically stored just like any other Oracle data type, in the data files that make up the database, the .dbf files. They're not stored as seperate files that you can use outside of Oracle.
    Oracle has a seperate special data type for binary objects stored outside the database, the BFILE data type. However, this type is read-only from a database connection (and therefore from JDBC); the files have to be placed on the Oracle server some other way and the BFILE object is created as a pointer to that external resource. I think built-in stored procedures are used to actually read the data from the binary object.
    I've never used this datatype and can't tell you much more about it. See the documentation:
    http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements001.htm#sthref175

  • How to Store and Retrieve values in cookie

    Hi am having two List boxes in a jsp page.. By default i will give set of values to one List box and then i will move some value from one list box to another list box.. Now my requirement is i have to store these two list box values into cookie.. If i come back the page again it shoud show the previous values in list boxes.. If any one knows this please guide me..
    Thanks

    Why do you need to use cookies in your case? A session attribute would be more reliable.

  • Help with unsigned ints and how to store and retrieve data in them

    Hi all
    I have a problem where some data is being stored in an unsigned int
    i dont really know much about them and am unsure on how to go about using the data.
    The data being stored in them is row and column information in an excel spreadsheet.
    The method is passed through 2 ints (column, row) and then a unsigned int is created out of these two values
    the column is 8 bits and shift to the left hand byte (column & 0xFF <<24)
    the row is 16 bits shifted to the right of the column (row & 0XFFFF <<8)
    so if the column and row were 1,1 then the unsigned int would be
    16777472
    and for 1,2 then it would be 16777728
    (i dont actually know how these numbers are formed, it would be great if someone can explain this too :) )
    anyway now i have those unsigned int numbers does anyone know how i would go about taking that unsigned int and getting my int back from it
    so take 16777728 and extracting column 1, row 2
    any help would be appreciated

    its not a 3rd party product, its been written by
    another peep who is on holiday for 2 weeks so im
    trying to sort something out but dont really
    understand unsigned ints and stuff :(This is what is called a "third party product". It's not written by Sun, and it's not written by you.

  • Need advice on how to store and retrieve mathematical symbols - Oracle8i

    I am a student developing a web database for a P3 project and am having trouble inserting non-standard text particularly mathematical sybols (intergrals and the like) or Gifs/Jpegs. Could anybody give me some advice on how this should be done? I am using PHP, Oracle8i and Solaris.
    Cheers Pete

    >1. I have all of my RAW files on my Mac's desktop and they are organized at the top level by each of the 2 cameras they were taken with and then the sub folders of each organized chronologically with each subfolder titled by the location or subject of the images matter within each folder.
    >I want to import these into Lightroom 2.3 in a manner which will preserve this taxonomy.
    >I also want to convert these RAW images into DNG files on import. How do I set up LR2 to do this?
    On the Import Photos Screen, pick "Copy photos as Digital Negative(DNG) and add to catalog" from File Handling drop-down at top of screen.
    If your photos are organised as:
    Photos - Camera 1 ...
    - Camera 2 ...
    then Lightroom will reflect that folder view in its Folders panel. Also, when converting to DNG you get to choose destination folder (answers part of your question 2) and multiple organisation choices including "Organize by Original Folder"
    (Take a look at Chapter 4 of the help file for more information: http://help.adobe.com/en_US/Lightroom/2.0/lightroom_2_help.pdf)
    2. I want the Lightoom files and the image files....
    Create your catalog on that drive. Move your images to that drive before importing them, and when converting to DNG on import, choose a folder on that drive as destination on import screen.
    >Is RAID 1 as safe as backing up to 2 different HD's?
    No. RAID 1 is a simple mirror of 1 drive on another; so if you delete a file on drive, it is also deleted from both drives. Likewise, if a file is corrupted on one drive it will also be corrupted on the mirror. RAID 1 is good as a safeguard against single-drive failure; your data will be available from the remaining drive, but it is not a safeguard against user error or file corruption.

  • How to store and retrieve image in a apache derby using JDBC

    hi all
    this is source code i copy and modify but get error message like this
    import java.io.*;
    import java.sql.*;
    import java.util.Properties;
    import java.awt.*;
    import javax.swing.*;
    public class ImageDemo{
    public static void main(String argv[]){
    try{
    String url="jdbc:derby:derDB2";
    Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
    Properties properties=new Properties();
    Connection connection = DriverManager.getConnection(url,properties);
    Statement stmt = connection.createStatement();
    stmt.execute("create database if not exists imagedatabase");
    stmt.execute("create table if not exists imagetable (imageid int,IMAGE_DATA blob)");
    File file=new File("c:\\c.jpg");
    FileInputStream in=new FileInputStream(file);
    PreparedStatement ps=connection.prepareStatement("insert into imagetable (imageid,IMAGE_DATA) values(?,?)");
    ps.setInt(1,1234);
    ps.setBinaryStream(2,in,(int)file.length());
    ps.execute();
    ps.close();
    ResultSet rs =stmt.executeQuery("select IMAGE_DATA from imagetable where imageid=1234");
    byte[] imgbytes=null;
    if(rs.next()) {
    imgbytes=rs.getBytes(1);
    rs.close();
    stmt.close();
    connection.close();
    if(imgbytes!=null){
    JFrame fr = new JFrame();
    fr.setTitle("Simple Demo for Load Image from MS Access");
    Image image = fr.getToolkit().createImage(imgbytes);
    fr.getContentPane().add(new PaintPanel(image));
    fr.setSize(200,400);
    fr.setVisible(true);
    Thread.sleep(10000);
    System.exit(0);
    catch( SQLException sqle )
    do
    System.out.println(sqle.getMessage());
    System.out.println("Error Code:"+sqle.getErrorCode());
    System.out.println("SQL State:"+sqle.getSQLState());
    sqle.printStackTrace();
    }while((sqle=sqle.getNextException())!=null);
    catch( Exception e )
    System.out.println(e.getMessage());
    e.printStackTrace();
    class PaintPanel extends JPanel {
    private Image image;
    public PaintPanel(Image image) {
    this.image = image;
    public void paintComponent(Graphics g) {
    super.paintComponent(g);
    g.drawImage(image, 0, 0, this);
    and this is the error message
    Syntax error: Encountered "database" at line 1, column 8.
    Error Code:30000
    SQL State:42X01
    ERROR 42X01: Syntax error: Encountered "database" at line 1, column 8.
         at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
         at org.apache.derby.impl.sql.compile.ParserImpl.parseStatement(Unknown Source)
         at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
         at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
         at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
         at ImageDemo.main(ImageDemo.java:28)

    It's complaining about this SQL in your code:create database if not exists imagedatabaseThat doesn't exactly look right to me. And perhaps "database" is a reserved word and can't be used in that position. At any rate I would recommend you create your database and tables in some other way before you write Java code to use them. Does Derby have a command-line interface or a GUI manager program? Use them if they exist to set up your tables.

  • How to store and retrieve .jpeg images from oracle database.

    I am using JSP. Can anybody tell me the process of doing it.

    I believe Oracle reccommends to use BLOBs for storing large binary data.
    Check on DBMS_LOB package on Oracle documentation: it has all the API's you
    need.

Maybe you are looking for

  • Error while opening modal (skillbuilder plugin)  page on page load

    Hi all, I'm using 4.2.1. ( on 11GR2 ), theme 25. Skillbuilder Modal page plugin v2 Modal pages are working great, on all kinds of events, but if I try to open one via a D.A. on page load it fails with "Uncaught TypeError: Object load has no method 's

  • ITunes won't search App Store

    Just started happening tonight. When searching in iTunes, nothing shows up from the App Store. Searching for known apps that even show up with the autofill function. But no results are shown. Music, movies, all show, just no apps. Anyone else, or jus

  • Vertical scrolling with TrackPoint's middle button won't work on MS Word

    Question: I have a T42 ThinkPad and the vertical scrolling with TrackPoint's middle button won't work on MS Word and therefore not in my email either. Big pain in butt as I'm so used to using it. Are there any patches that fix that? Any ideas on why

  • Query Dimension 1-Cache Data

    Hi, I am running a MDX query  and when I checked in profiler its showing a long list of Query dimension (Event Class) 1-Cache data, What does it mean? I think its not hitting storage engine rather pulling from cache but why so much caching. What does

  • Error in executing command

    Hello, I am trying to execute nqcmd command in unix envt throgh putty to purge cache but it giving me following error....I went through blog, but its not much helpful. I new to unix: below is the error exec(): 0509-036 Cannot load program nqcmd becau