Read japanese char from oracle

I have a database column stores japanese char in Shift-JIS encoding. A
perl script can read the database and display the result on browser.
But If i try the get the japanese string in Java using JDBC. I got an
exception:
String text = resultset.getString(1);
Exception in main(): java.sql.SQLException: Fail to convert between
UTF8 and UCS2: failUTF8Conv
I wonder why I getting this exception and how to fix this?
thanks

Hi
We had faced the same problem.
Problem was with oracle jdbc thin driver.
We change the driver from THIN to OCI that works fine.
Try this option and pls let me know.
Regards,
Aslam A.S

Similar Messages

  • Reading Japanese Characters from Properties File

    I am running on Windows 2000 (English). Can any one suggest on how to read Japanese Characters from a ".properties" file.
    TIA

    look at ResourceBundle and unicode encoding,
    Jim

  • Problem with Pro*C reading BLOB field from Oracle 10g

    Hello Experts,
    We have a Pro*c application which is reading the BLOB data fields (a PNG image file) from Oracle data base. It holds the BLOB fields returned from the SQL query into a Unsigned Char structure in Pro*C. The program used work fine on AIX 32 – bit 4.3 and Oracle 8.1 environment.
    Recently, we have upgraded the environment to AIX 64-bit 5.3 and Oracle 10g.Since after the Pro*c program has problem in reading the Blob filed.
    Below is the query we are trying to execute –
    EXEC SQL
    SELECT
    signtre_image, image_file_name_ext
    INTO
    :msipLocalImage INDICATOR :msipLocalImage_i,
    :file_name_ext INDICATOR :file_name_ext_i
    FROM
    dcs_sign
    WHERE
    signtre_nbr = :signtre_nbr;
    Here signtre_image is the BLOB fields and msipLocalImage is a Pro*C structure define as below –
    typedef struct tagSignImage
    long len; /* Image length */
    unsigned char img[1]; /* Pointer to first byte. */
    } MOTS_SIGN_IMAGE;
    The quesry does not give any error or exception message in the Pro*C , program just stops at the point of executing the quesry..When we run the query commenting the BLOB filed it works fine. Also, the query runs good when we run it in the Oracle editor.
    There seems to be problem with the way we are reading the BLOB field in the new Oracle 10g enviromet.
    Does any body have any idea what’s wrong with this query? We really need it to work.
    Any Help will be greatly appreciated.
    Thanks,
    - Rajan Yadav

    Thanks a ton for your response.
    We made the necessary changes as suggested by you.This time we got another flavour of error - SQL Error Code - Inconsistent error while reading BLOB.
    Another thing we noticed is that the data field which we are trying to read is defined as LONG RAW instead of a BLOB in data base.
    Are these two things related in any sense or is there anything else which is causing the error.
    Once again Thanks for your help.
    - Rajan Yadav

  • Problem with reading special char from file

    Hello Oracle community,
    Got a problem when reading from a file. I am using a croatian keyboard and trying to read special charachters (ČĆŽŠĐ) from a file.
    declare
      l_file utl_file.file_type;
      s varchar2(200);
    begin
      l_file := utl_file.fopen('test_dir', 'test.txt', 'R');
      loop
        utl_file.get_line(l_file, s);
        dbms_output.put_line(s);
      end loop;
    exception
      when no_data_found then
        utl_file.fclose(l_file);
    end;But I keep getting this in dbms_output: ČƎŠĐ. For some reason it keeps skipping 2 chars Š and Ž. If I try to insert or update data the values are show correctly. What could be the cause of such a problem?
    Best regards,
    Igor

    Hi Igor,
    Looks like a NLS_LANGUAGE issue. Check the following threads:
    UTL_FILE and NLS_LANG setting
    Re: Arabic characters not displaying in Forms
    Regards,
    Sujoy

  • How to read Image data from oracle DB?

    How to read a oracle database object ORDSYS.ORDImage from oracle
    database?
    I can get a oracle.sql.STRUCT object from the database, but i can not
    find the way to convert data to a image object(like oracle.ord.im.OrdImage)
    I had used "OrdImage imgObjj1 =
    (OrdImage)rs.getCustomDatum(1, OrdImage.getFactory());"
    it's a example from oralce.
    But OracleResultSet.getCustomDatum() method is already deprecated,
    i can't find a new method to instead of it.
    Who can help me ? Thank you!
    [email protected]

    More than likely, this is the interface you will use:
    java.sql.Blob
    http://java.sun.com/j2se/1.4/docs/api/java/sql/Blob.html
    Once you get the blob, construct a Raster objects from the Bytes you receive from the blob. Then you can create an Image, ImageIcon, BufferedImage, whatever with the Raster object.
    Good luck!

  • Error when reading BLOB field from Oracle usin Toplink

    We experience a very annoying problem when trying to read a BLOB
    field from Oracle 8.1.6.2.0 using TOPLink 3.6.3. I have attached the
    exception stack trace that is reported to the console. As far as I can
    judge a fault at oracle.sql.LobPlsqlUtil.plsql_length() happens first and
    then at TOPLink.Private.DatabaseAccess.DatabasePlatform.convertObject().
    The exception is permanently repeating that is very critical for us.
    ServerSession(929808)--Connection(5625701)--SELECT LOBBODY, ID, LABEL, FK_OBJECT_ID, FK_OBJECTTYPE FROM NOTE WHERE (ID = 80020)
    INTERNAL EXCEPTION STACK:
    java.lang.NullPointerException
    at oracle.sql.LobPlsqlUtil.plsql_length(LobPlsqlUtil.java:936)
    at oracle.sql.LobPlsqlUtil.plsql_length(LobPlsqlUtil.java:102)
    at oracle.jdbc.dbaccess.DBAccess.lobLength(DBAccess.java:709)
    at oracle.sql.LobDBAccessImpl.length(LobDBAccessImpl.java:58)
    at oracle.sql.BLOB.length(BLOB.java:71)
    at TOPLink.Private.Helper.ConversionManager.convertObjectToByteArray(ConversionManager.java:309)
    at TOPLink.Private.Helper.ConversionManager.convertObject(ConversionManager.java:166)
    at TOPLink.Private.DatabaseAccess.DatabasePlatform.convertObject(DatabasePlatform.java:594)
    at TOPLink.Public.Mappings.SerializedObjectMapping.getAttributeValue(SerializedObjectMapping.java:43)
    at TOPLink.Public.Mappings.DirectToFieldMapping.valueFromRow(DirectToFieldMapping.java:490)
    at TOPLink.Public.Mappings.DatabaseMapping.readFromRowIntoObject(DatabaseMapping.java:808)
    at TOPLink.Private.Descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:173)
    at TOPLink.Private.Descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:325)
    at TOPLink.Private.Descriptors.ObjectBuilder.buildObjectsInto(ObjectBuilder.java:373)
    at TOPLink.Public.QueryFramework.ReadAllQuery.execute(ReadAllQuery.java:366)
    at TOPLink.Public.QueryFramework.DatabaseQuery.execute(DatabaseQuery.java:406)
    I have started the application with Oracle JDBC logging on and found that the problem may originate in a possible lack of syncronization in the pooled connection implementation:
    DRVR FUNC OracleConnection.isClosed() returned false
    DRVR OPER OracleConnection.close()
    DRVR FUNC OracleConnection.prepareCall(sql)
    DRVR DBG1 SQL: "begin ? := dbms_lob.getLength (?); end;"
    DRVR FUNC DBError.throwSqlException(errNum=73, obj=null)
    DRVR FUNC DBError.findMessage(errNum=73, obj=null)
    DRVR FUNC DBError.throwSqlException(reason="Logical handle no longer valid",
    SQLState=null, vendorCode=17073)
    DRVR OPER OracleConnection.close()
    so the prepareCall() is issued against an already closed connection and the
    call fails.
    I assume we have been using a JDBC 2.0 compliant driver. We tried out
    drivers that Oracle supplies for 8.1.6, 8.1.7 versions. To be true I
    couldn't find any information about the JDBC specification they conform to. Does it
    mean that these drivers may not be 100%-compatible with JDBC 2.0 Spec?
    How can I find out if they are 2.0 compliant?
    Also I have downloaded Oracle 9.2.0.1 JDBC drivers. This seemed to work
    fine until we found another incompatibility which made us return back to
    8.1.7 driver:
    UnitOfWork(7818028)--Connection(4434104)--INSERT INTO STATUSHISTORY (CHANGEDATE, FK_SET_STATUS_ID) VALUES ({ts '2002-10-17 16:46:54.529'}, 2)
    INTERNAL EXCEPTION STACK:
    java.sql.SQLException: ORA-00904: invalid column name
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093
    at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.jav
    a:2047)
    at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java
    :1940)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatemen
    t.java:2709)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePrepare
    dStatement.java:589)
    at TOPLink.Private.DatabaseAccess.DatabaseAccessor.executeDirectNoSelect(
    DatabaseAccessor.java:906)
    at TOPLink.Private.DatabaseAccess.DatabaseAccessor.executeNoSelect(Databa
    seAccessor.java:960)
    at TOPLink.Private.DatabaseAccess.DatabaseAccessor.executeCall(DatabaseAc
    cessor.java:819)
    at TOPLink.Public.PublicInterface.UnitOfWork.executeCall(UnitOfWork.java:

    Hello Yury,
    I believe the problem is that TopLink's ServerSession by default executes read queries concurrently on the same connection. It does this to reduce the number of required connections for the read connection pool. Normally this is a good concurrency optimization, however some JDBC drivers have issues when this is done. I had thought that with Oracle JDBC 8.1.7 this issue no longer occurred, but perhaps it is only after version 9. I believe that the errors were only with the thin JDBC driver, not the OCI, so using the OCI driver should also resolve the problem. Using RAW instead of BLOB would also work.
    You can configure TopLink to resolve this problem through using exclusive read connection pooling.
    Example:
    serverSession.useExclusiveReadConnectionPool(int minNumerOfConnections, int maxNumerOfConnections);
    This will ensure that TopLink does not to try to concurrently execute read queries on the same connection.
    I'm not exactly sure what your second problem with the 9.x JDBC drivers is. From the SQL and stack trace it would seem that the driver does not like the JDBC timestamp syntax. You can have TopLink print timestamp in Oracle's native SQL format to resolve this problem.
    Example:
    serverSessoin.getLogin().useNativeSQL();
    Make sure you configure your server session before you login, or if using the TopLink Session Manager perform the customizations through a SessionEventListener-preLogin event.

  • Read exchange mailbox from oracle

    Hello all,
    Is there anyway i can read a mailbox in outlook from forms with pl/sql or anything else ?
    thanks

    Right now i can't find the link, but i've the content which was posted by Billy in this forum. So, i'm posting it exactly what he posted -
    > Can you provide me some references for the same? (sample inplementation or study
    material)
    Well, here is a very basic example of a PL/SQL pipelined table function that wraps a POP3 mail account into a SQL table - allowing you to run SQLs directly against the e-mail account.
    I did a few basic tests using a local POP3 server on my Linux box and it seems to work fine.
    SQL> create or replace type TStrings is table of varchar2(4000);
      2  /
    Type created.
    SQL>  
    SQL> create or replace function pop3( userName varchar2, password varchar2, msgNum number ) return TStrings pipelined is
      2          POP3_SERVER             constant varchar2(19) := '127.0.0.1';
      3          POP3_PORT               constant number := 110;
      4          POP3_TIMEOUT            constant number := 5;
      5          POP3_OK                 constant varchar2(10) := '+OK';
      6
      7          E_POP3_ERROR    exception;
      8          E_READ_TIMEOUT  exception;
      9          pragma exception_init( E_READ_TIMEOUT, -29276 );
    10
    11          socket  UTL_TCP.connection;
    12          line    varchar2(4000);
    13          bytes   integer;
    14
    15          -- send a POP3 command
    16          -- (we expect each command to respond with a +OK)
    17          function  WriteToPop( command varchar2 ) return varchar2 is
    18                  len     integer;
    19                  resp    varchar2(4000);
    20          begin
    21                  len := UTL_TCP.write_line( socket, command );
    22                  UTL_TCP.Flush( socket );
    23
    24                  -- using a hack to check the popd response
    25                  len := UTL_TCP.read_line( socket, resp );
    26
    27                  if SUBSTR(resp,1,3) != POP3_OK then
    28                          raise E_POP3_ERROR;
    29                  end if;
    30
    31                  return( resp );
    32          end;
    33
    34
    35
    36  begin
    37          PIPE ROW( 'pop3:'||POP3_SERVER||' port:'||POP3_PORT );
    38          -- open a socket connection to the POP3 server
    39          socket := UTL_TCP.open_connection(
    40                          remote_host => POP3_SERVER,
    41                          remote_port => POP3_PORT,
    42                          tx_timeout => POP3_TIMEOUT,
    43                          charset     => 'US7ASCII'
    44          );
    45
    46          -- read the server banner/response from the pop3 daemon
    47          PIPE ROW( UTL_TCP.get_line(socket) );
    48
    49          -- authenticate with the POP3 server using the USER and PASS commands
    50          PIPE ROW( 'USER '||userName ); PIPE ROW( WriteToPop('USER '||userName) );
    51          PIPE ROW( 'PASS '||password ); PIPE ROW( WriteToPop('PASS '||password) );
    52
    53          -- retrieve the specific message
    54          PIPE ROW( 'RETR '||msgNum ); PIPE ROW( WriteToPop('RETR '||msgNum) );
    55          PIPE ROW( '*** START OF INTERNET MESSAGE BODY ***' );
    56          loop
    57                  bytes := UTL_TCP.Available( socket );
    58                  if bytes > 0 then
    59                          bytes := UTL_TCP.read_line( socket, line );
    60                          PIPE ROW( line );
    61                  end if;
    62
    63                  exit when bytes = 0;
    64          end loop;
    65          PIPE ROW( '*** END OF INTERNET MESSAGE BODY ***' );
    66
    67          -- close connection
    68          PIPE ROW( 'QUIT' );     PIPE ROW( WriteToPop('QUIT') );
    69
    70          UTL_TCP.close_connection( socket );
    71  end;
    72  /
    Function created.
    SQL> show errors
    No errors.
    SQL>
    SQL> select * from TABLE( pop3('billy','my-secret-password-goes-here',1) );
    COLUMN_VALUE
    pop3:127.0.0.1 port:110
    +OK You are connected to a test Dovecot POP3 server
    USER billy
    +OK
    PASS my-secret-password-goes-here
    +OK Logged in.
    RETR 1
    +OK 548 octets
    *** START OF INTERNET MESSAGE BODY ***
    Return-path: <[email protected]>
    Envelope-to: [email protected]
    Delivery-date: Mon, 20 Aug 2007 09:23:38 +0200
    Received: from localhost ([127.0.0.1])
            by localhost.com with smtp (Exim 4.63)
            (envelope-from <[email protected]>)
            id 1IN1bC-0001BC-9A
            for [email protected]; Mon, 20 Aug 2007 09:23:38 +0200
    Subject: Test E-Mail
    X-Mailer: telnet
    Message-Id: <[email protected]>
    From: [email protected]
    Date: Mon, 20 Aug 2007 09:23:21 +0200
    This is a test message.
    Blah blah blah...
    *** END OF INTERNET MESSAGE BODY ***
    QUIT
    +OK Logging out.
    31 rows selected.
    SQL>Note that the trailing period is the end-of-message-body marker and not really part of the message body that the sender created.
    PS. Oh yes - I defined a timeout exception and tried catching that to determine the eof for the message body, but ran into what seems to be an Oracle bug. However, simply checking whether there is data to read, using the UTL_TCP.Available() function, works great.
    Regards.
    Satyaki De
    N.B.: Credit goes to Billy.

  • Read IMAP server from Oracle PL/SQL

    Hi,
    Is it possible to read emails (either through IMAP) and save those email (with attachments) into oracle tables through pl/sql?
    I have a requirement of reading mailbox every 1 min and save new mails into database.
    My Environment: Database 10g.

    This may help you.
    Re: Retrieve emails from IMAP server
    http://plsqlmailclient.sourceforge.net/

  • Reading Japanese characters from a JSP/HTML form.

    I have a JSP/STRUTS/WEBLOGIC/ORACLE setup. I am able to get Japanese characters in database to be shown on the screen ( html ). However the users now want to enter Japanese characters on the screen and want to save these unicode characters in DB. How should I go about it?
    I am using html:text tag for the input fields in the JSP. No matter what I try I am getting invalid characters..Thanks in advance.

    hi debo_nair,
    if i am not mistaken the japanese characters might be getting stored in the database as '?????' and other junk characters....
    well I used the following technique:
    1.retrieve the string from the text field and
    2.convert it using the following method...
    new String getbytes("the string entered in the text field","ISO-8859")
    3.Next , store the string in the database
    the syntax may be incorrect but just refer to any java book to get the correct syntax
    regds

  • Reading XML Files from oracle 9i or in Oracle 10g

    Hi all,
    Can any body suggest how to write a stored procedure to read XML file content and insert into a table.
    Thanking you in Advance

    I know I am blasphemous, but ....
    We had a similar requirement: one file, each line was a "simple" xml doc corresponding to one db table record. The keyword here is "simple". We looked at the xml stuff, but decided that the easiest, best runtime performance, most extensible, easiest to maintain was:
    use (sed|awk|perl) to convert xml to a flat file of fields, and then load the file with SQL*Loader. After all, loading flat files with many records is a job for SQL*Loader.
    caveat: the xml in question was very simple and the same for all records:
    timestamp|<log><id>1</id><ns>ns1</ns><prod/><cmd>order</cmd><result>ok</result><time>1813></time></log>
    "your milage may vary"
    -tom

  • Error While reading CLOB from Oracle using WebLogic Connection Pool, Works fine with out using pool

    PROBLEM DESCRIPTION :
         When I try to read a clob from Oracle, I receive "ORA-03120: two-task
    conversion routine: integer overflow" Error.
         This error occurs only for CLOB Type and only if I try to connect to
    Oracle using WebLogic JDriver/Oracle POOL.
         IMPORTANT NOTE: I can read CLOB or any other data using direct JDBC
    connection to ORacle with out any problem.
         Below Please find the JAVA CODE for Both Working and NON Working .
    Created a Connection Pool as:
    Name: MyJDBCConnectionPool
    URL : jdbc:weblogic:oracle
    DIRVER:weblogic.jdbc.oci.Driver
    NON WORKING JAVA CODE (USES WEBLOGIC JDBC CONNECTION POOL TO ORACLE):
    Driver myDriver =
    (Driver)Class.forName("weblogic.jdbc.pool.Driver").newInstance();
    Connection mconn =
    myDriver.connect("jdbc:weblogic:pool:MyJDBCConnectionPool",null);
    mconn.setAutoCommit (false);
    CallableStatement cs = mconn.prepareCall("{call
    P_XMLTEST2(?)}"); //This returns a CLOB
    cs.registerOutParameter(1,java.sql.Types.CLOB);
    cs.execute();
    Clob clob = null;
    clob = cs.getClob(1);
    String data =new String();
    data = clob.getSubString(1, (int)clob.length());
    System.out.println(data); //print the data
    data = null;
    clob=null;
    cs.close();
    WORKING JAVA CODE (USES DIRECT THIN JDBC CONNECTION TO ORACLE):
    Driver myDriver =
    (Driver)Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    Connection mconn =
    myDriver.connect("jdbc:oracle:thin:@server:1521:DB",null);
    mconn.setAutoCommit (false);
    CallableStatement cs = mconn.prepareCall("{call
    P_XMLTEST2(?)}"); //This returns a CLOB
    cs.registerOutParameter(1,java.sql.Types.CLOB);
    cs.execute();
    Clob clob = null;
    clob = cs.getClob(1);
    String data =new String();
    data = clob.getSubString(1, (int)clob.length());
    System.out.println(data); //print the data
    data = null;
    clob=null;
    cs.close();
    ERROR MESSAGE:
         ORA-03120: two-task conversion routine: integer overflow
    I appreciate your help on this problem.

    PROBLEM DESCRIPTION :
         When I try to read a clob from Oracle, I receive "ORA-03120: two-task
    conversion routine: integer overflow" Error.
         This error occurs only for CLOB Type and only if I try to connect to
    Oracle using WebLogic JDriver/Oracle POOL.
         IMPORTANT NOTE: I can read CLOB or any other data using direct JDBC
    connection to ORacle with out any problem.
         Below Please find the JAVA CODE for Both Working and NON Working .
    Created a Connection Pool as:
    Name: MyJDBCConnectionPool
    URL : jdbc:weblogic:oracle
    DIRVER:weblogic.jdbc.oci.Driver
    NON WORKING JAVA CODE (USES WEBLOGIC JDBC CONNECTION POOL TO ORACLE):
    Driver myDriver =
    (Driver)Class.forName("weblogic.jdbc.pool.Driver").newInstance();
    Connection mconn =
    myDriver.connect("jdbc:weblogic:pool:MyJDBCConnectionPool",null);
    mconn.setAutoCommit (false);
    CallableStatement cs = mconn.prepareCall("{call
    P_XMLTEST2(?)}"); //This returns a CLOB
    cs.registerOutParameter(1,java.sql.Types.CLOB);
    cs.execute();
    Clob clob = null;
    clob = cs.getClob(1);
    String data =new String();
    data = clob.getSubString(1, (int)clob.length());
    System.out.println(data); //print the data
    data = null;
    clob=null;
    cs.close();
    WORKING JAVA CODE (USES DIRECT THIN JDBC CONNECTION TO ORACLE):
    Driver myDriver =
    (Driver)Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    Connection mconn =
    myDriver.connect("jdbc:oracle:thin:@server:1521:DB",null);
    mconn.setAutoCommit (false);
    CallableStatement cs = mconn.prepareCall("{call
    P_XMLTEST2(?)}"); //This returns a CLOB
    cs.registerOutParameter(1,java.sql.Types.CLOB);
    cs.execute();
    Clob clob = null;
    clob = cs.getClob(1);
    String data =new String();
    data = clob.getSubString(1, (int)clob.length());
    System.out.println(data); //print the data
    data = null;
    clob=null;
    cs.close();
    ERROR MESSAGE:
         ORA-03120: two-task conversion routine: integer overflow
    I appreciate your help on this problem.

  • Read from Oracle DB and Write to MySQL

    Hi All,
    I am fairly new to database administration, so please bear with me if this is something that is simple or not achievable at all -
    SetUp:
    I have an Oracle DB on one dedicated Server, to which I only have a read_only access.
    I have a MySQL database setup on a windows server 2008, both are on the company network and accessible to internal employees only.
    Problem Statement:
    I need to read certain tables from Oracle DB and push the records to MySQL database.
    I have a stored procedure which was doing this but from one Oracle Schema to another, which is running fine, now I need to use the same stored procedure but read from one database (Oracle) and write to another database (MySQL), is there a way to do this through the stored procedure, I know I can write a java program to do this, but need to do it through a stored procedure.
    Appreciate any help in this regards.

    c5b4a91d-d35a-43ba-ac96-6d1821541d33 wrote:
    Hi All,
    I am fairly new to database administration, so please bear with me if this is something that is simple or not achievable at all -
    SetUp:
    I have an Oracle DB on one dedicated Server, to which I only have a read_only access.
    I have a MySQL database setup on a windows server 2008, both are on the company network and accessible to internal employees only.
    Problem Statement:
    I need to read certain tables from Oracle DB and push the records to MySQL database.
    I have a stored procedure which was doing this but from one Oracle Schema to another, which is running fine, now I need to use the same stored procedure but read from one database (Oracle) and write to another database (MySQL), is there a way to do this through the stored procedure, I know I can write a java program to do this, but need to do it through a stored procedure.
    Appreciate any help in this regards.
    Start here:  http://docs.oracle.com/cd/E11882_01/server.112/e25494/ds_concepts.htm#i1007709

  • ThrowNew() with Japanese chars went wrong

    Hi All.
    I want to throw exception that has Japanese chars from C++ code.
    char szMsg[256];
    // put Japanese chars into szMsg.
    // ... and throw exception.
    env->ThrowNew(exceptionClass, (const char*)szMsg);
    Then, in Java code, it is displayed with unreadable characters like "????".
    How can I get a readable string from C++?
    Thank you.

    Thank you for your reply.
    But I'm not familiar with C++, could you tell me in detail?
    My project is compiled with _MBCS option, and I tried to convert string to UNICODE to get readable string in JNI by using
    (1) MultiByteToWideChar(...)
    const char* szErrMsg = "...."; // including Japanese character
    WCHAR szUnicodeMsg[256];
    MultiByteToWideChar(GetACP(), 0, szErrMsg, -1, szUnicodeMsg,
    sizeof(szUnicodeMsg)/sizeof(wchar_t));
    env->ThrowNew(ExceptionCls, (const char*)szUnicodeMsg);
    (2) mbstowcs(...)
    mbstowcs(szUnicodeMsg, szErrMsg, strlen(szErrMsg)+1);
    env->ThrowNew(ExceptionCls, (const char*)szUnicodeMsg);
    (3) T2CW() macro
    env->ThrowNew(ExceptionCls, (const char*)T2CW(szErrMsg));
    Result
    In case (1), unexpected string (like "B0D0F0H0J0?0") was displayed.
    (by calling Throwable#getMessage() in JNI)
    In case (2), only '?' was displayed in JNI.
    In case (3), I got the same result as case (1).
    Do you mean another way?
    Thank you.

  • Read Tif Image from Database Display in Windows Fax Viewer

    Code for reading a BLOB from Oracle which is a TIF image and displaying it in Windows Picture and Fax Viewer. Gives the ability to display with perfect resolution, Zoom In & Out, Rotate and Print.
    I m storing the image on my C drive, you can store where ever you want.
    package com.test.examples;
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import oracle.sql.BLOB;
    public class Test {
         * Main method for calling the View Tif Image method.
         * @param args
         public static void main(String[] args) {
              String id = "123";
              Test test = new Test();
              test.viewTifImage(id);
         * Method for viewing TIF Image
         public void viewTifImage(final String id) {
              BLOB blob = null;
              FileOutputStream outStream = null;
              InputStream inStream = null;
              final String filename = "C:\\Images\\image.tif";
              if (Helper.stringNotNullAndEmpty(id)) {
                   try {
                        imageDAO = new ImageDAO();
                        blob = imageDAO.getImageBLOB(id);
                        File blobFile = new File(filename);
                        outStream = new FileOutputStream(blobFile);
                        inStream = blob.getBinaryStream();
                        int length = -1;
                        int size = new Long(blob.length()).intValue();
                        byte[] buffer = new byte[size];
                        while ((length = inStream.read(buffer)) != -1) {
                             outStream.write(buffer, 0, length);
                             outStream.flush();
                        showTiff(filename);
                        inStream.close();
                        outStream.close();
                   } catch (IOException ioe) {
                        System.out.println("Exception in IO block.");
                        ioe.printStackTrace();
                        try {
                             inStream.close();
                             outStream.close();
                        } catch (IOException ioe1) {
                             ioe1.printStackTrace();
                   }catch (DAOException daoe) {
                        System.out.println("Exception while getting the BLOB");
                        daoe.printStackTrace();
                   } catch (Exception ex) {
                        System.out.println("ERROR(djv_exportBlob) Unable to export:"
                                  + filename);
                        ex.printStackTrace();
                   } finally {
                        try {
                             inStream.close();
                             outStream.close();
                        } catch (IOException e) {
                             System.out.println("Exception in IO block.");
                             e.printStackTrace();
         public static boolean showTiff(String fileName) throws IOException {
              String progDir = System.getenv().get("SystemRoot");
              System.out.println("SYSTEM ROOT DIRECTORY" + progDir);
              // turn the backslash around to a forward slash
              int x = progDir.indexOf('\\');
              String front = progDir.substring(0, x);
              String back = progDir.substring(x + 1);
              progDir = front + "/" + back;
              String osCmd = progDir + "/system32/rundll32.exe " + progDir
                        + "/system32/shimgvw.dll,ImageView_Fullscreen " + fileName;
              try {
                   System.out.println("command is " + osCmd);
                   Runtime rt = Runtime.getRuntime();
                   Process ps = rt.exec(osCmd);
              } catch (IOException ie) {
                   System.out.println("error running fax viewer");
                   return false;
              return true;
    Let me know if you find some thing wrong in here.
    Thanks
    raffu

    REad all the file paths from DB in e.g. List<String>. Define javax.swing.Timer.
    How to use timer read here
    http://leepoint.net/notes-java/other/10time/20timer.html
    or
    http://docs.oracle.com/javase/tutorial/uiswing/misc/timer.html
    When the timer's actionPerformed happens use next index in the array to get next filePath and show your image. When end of list is achieved just stop the timer (or startd from the beginning of the list again).

  • WebUtil Using Client_Text_IO with Japanese chars

    Hi, I am trying to use Client_Text_IO to read text file with Japanese characters in it. But it seems like Client_Text_IO can't read Japanese chars properly. Can anyone tell me how to use Client_Text_IO with double byte
    chars like Japanese?
    Thanks in advance for any help.
    Tad Teramoto

    Hi Frank,
    Thank you for your reply. Could you be a bit more specific about what this bug 3075927 really is? Is this a problem only in handling files with muli-byte chars or does it have an effect on other functions? And is there any workaround for it?
    Thanks

Maybe you are looking for

  • Number of records in SETUP table

    Hello I am working with PO extractor. Is the number of records in XXXXXXSETUP table equal to the number of records setup?

  • How do I get camera raw plugin for cs5.1 extented for new olympus omd e-m1 camera?

    how do you get camera raw plugin for cs5.1 extented for new olympus omd e-m1 camera?

  • ITunes won't detect eligible upgrades

    iTunes refuses to upgrade Wolf Parade's 'Apologies to Queen Mary' in it's entirety. I have been able to upgrade 3 songs from the album and iTunes doesn't even list those songs as upgradable now. What is going on? The attached images show the folder w

  • New to SAP XI

    Hi, I am working on webMethods... Now i want to shift from webMethods to SAP XI. Are there any prerequisites need to learn SAP XI as i am not familiar with SAP. I heartly welcomes all the suggestion from you folks.... Thanks vasu

  • What's the best way to share media between iTunes libraries?

    I just got my wife her own MacBook, and we definitely want to share media. I know she can set up her own itunes account and we can HomeShare but I am not sure if this is better for some reason than just logging her in with my itunes account. Is it be