Charsets - java -oracle

Hi,
I am trying to transfer data from an Oracle -Long field to an
CLOB field in another Oracle- database.
The transfer of the data works fine, except for the tranfer
of the euro -currency -sign.
The charsets of the databases are set to ISO8859-15.
This charset is supported on my operating system
Charset.availableCharsets()When i output the hex-representation of the
euro-sign I get the following:
ffffffef, ffffffbf, ffffffbd
according to the ISO8859-15 code-chart this should be 'A4' I guess.
I have tried various scenarious, e.g reading the input with
the encoding "ISO8859-15", reading it with "windows-1252" and
converting it to ISO8859-15, but without any success.
When I read the data via sqlplus(which also works with ISO8859-15)
I get the euro currency sign and I get a byte-value 128(which seems
to be correct). Here the charset conversion seems to be o.k..
I am using Windows-NT, with Oracle-jdbc-ThinClient.
somehow the oracle client does some characterset-conversion that
I am missing, but nevertheless I am just reading the bytes and
get wrong Hex-digits!!!?????.
thanks for any help,
regards,
alex
InputStream druckdat = rs.getBinaryStream(colDruckdat);
     try{
        //inputReader = new InputStreamReader(druckdat, "ISO8859-15");
     byte[] byteArr = new byte[10000];
        druckdat.read(byteArr);
     printHexString(byteArr);
     //String string = new String(byteArr, "windows-1251");
     //printHexString(string);
void printHexString(byte[] byteArr){
               for(int k=0; k<byteArr.length; k++){
                    if(k % 8 == 0)
                         System.out.println("\n");
                    System.out.print(Integer.toHexString(new Integer(byteArr[k]).intValue()));
                    //System.out.print(new Integer(byteArr[k]).intValue());
                    System.out.print(",   ");

i am not sure if the problems i had with oracle are identical to yours, but anyway here is what i found out:
i had a oracle 9i with database character set of ISO8859P1 and national character set UTF8. Problem was that when i wanted to insert or read non-8859-1 characters i just got garbage. Reason was the automatic charset conversion done by the thin driver which first converts to the database character set before sending the data to the db. if one uses a NCHAR data type the db then converts it to the national character set in use there. This obviously is a problem when the database character set is only a subset of the national character set, resulting in information loss.
unfortunately one has to use oracle-specific API (OraclePreparedStatement and its method setFormOfUse( types. NCHAR) so the thin driver doesn't use this conversion. This problem continues if one dynamically creates a SQL statement and wants to do an executeQuery() (standard jdbc API), it again gets converted automagically by the thin driver but OracleStatement has no method to suppress the conversion. So to avoid charset conversion one has to use the UNISTR function and encode the string to UTF-16 code points.
Of (only some) help were the jdbc developers guide and the globalization docs from oracle you can find on tahiti.oracle.com
i suspect you suffer from the same problem as 8859-1 and 8859-15 differ most prominently in the euro sign, and i guess your database character set is set to ISO8859P1.

Similar Messages

  • PL/SQL Object Type - Java oracle.jbo.domain

    PL/SQL Object Type <-> Java oracle.jbo.domain
    can anybody help me, getting my domains to work?
    Following scenario:
    in pl/sql we have an object type called MULTI_LANGUAGE. This type is used for storing multilingual texts as nested table in one(!) column.
    So the object MULTI_LANGUAGE contains a member variable LANGUAGE_COLLECTION of type LANGUAGE_TABLE, which itself is a nested table of objects
    of the type LANGUAGE_FIELD (this again is only a language id and the corresponding content)
    Also the methods setContent(langID, langContent) and getContent(langId) are defined on Object MULTI_LANGUAGE.
    For example: Table having primary key, 2 other columns and one column of object type MULTI_LANGAGE (=nested table of objects)
    |ID|Column1|Column2|  multilingual Column  |
    |--|---------------------------------------|
    |  |       |       |  -------------------  |
    |  |       |       | | 1 | hello         | |
    |  |       |       |  -------------------  |
    |1 | foo   | bar   | | 2 | hallo         | |   <- Row Nr 1
    |  |       |       |  -------------------  |
    |  |       |       | | 3 | ola           | |
    |  |       |       |  -------------------  |
    |--|-------|-------|-----------------------|
    |  |       |       |  -------------------  |
    |  |       |       | | 1 | world         | |
    |  |       |       |  -------------------  |
    |2 | abc   | def   | | 2 | welt          | |   <- Row Nr 2
    |  |       |       |  -------------------  |
    |  |       |       | | 3 | ???  ;-)      | |
    |  |       |       |  -------------------  |
    |--|-------|-------|-----------------------|Now i've tried to modell this structure as an oracle.jbo.domain.
    class MultiLanguage extends Struct having this StructureDef:
    attrs[(0)] = new DomainAttributeDef("LanguageColl", "LANGUAGE_COLL", 0, oracle.jbo.domain.Array.class, 2003, "ARRAY", -127, 0, false, "campusonlinepkg.common.LanguageField");
    and
    class LanguageField extends Struct having this StructureDef:
    attrs[(0)] = new DomainAttributeDef("Id", "ID", 0, oracle.jbo.domain.Number.class, 2, "NUMERIC", -127, 0, false);
    attrs[(1)] = new DomainAttributeDef("Content", "CONTENT", 1, java.lang.String.class, 12, "VARCHAR", -127, 4000, false);
    Is there anything wrong with this StructureDef?
    When running the BC-Browser with -Djbo.debugoutput=console -Djbo.jdbc.driver.verbose=true parameters I get suspect warnings when browsing the records
    [196] Executing FAULT-IN...SELECT NR, NAME FROM B_THESAURI BThesauri WHERE NR=:1
    [197] SQLException: SQLState(null) vendor code(17074)
    [198] java.sql.SQLException: Ungültiges Namensmuster: XMLTEST.null
    ...snip: detail of stack...
    [240] SQLException: SQLState(null) vendor code(17060)
    [241] java.sql.SQLException: Deskriptor konnte nicht erstellt werden: Unable to resolve type "null"
    ...snip: detail of stack...
    [280] Warning:No element type set on this array. Assuming java.lang.Object.
    (XMLTEST is the name of the schema)
    Seems as if the framework can't read the TypeDescriptor or does not know which descriptor to read (XMLTEST.null??)
    Do I have to implement my own JboTypeMap?
    Please help, I'm stuck.
    Thanks in advance, Christian

    Thanks for your suggestion, but it seems to me as if there is one level missing.
    in pl/sql I have following structure:
    Struct MULTI_LANGUAGE (Object type) - outermost
      Array LANGUAGE_TABLE (nested table type)
        Struct LANGUAGE_FIELD (Object type simple) - innermostthe reason why i had to wrap another struct around the array was because it is not possible to define methods on a nested table. this is only possible on objects.
    on the outermost object type (which holds the array of language fields) I needed to define following 2 methods for direct access:
    getContent (langId in number) returns varchar2
    setContent (langId in number, langContent in varchar2)
    I would like to rebuild the same structure in java, because newly written java code should live in perfect harmony with legacy pl/sql code ;-)
    Both applications (Java and pl/sql) have to access the same data as long as migration to java goes on.
    Is this nested structure too much for a Domain?
    Any other suggestions?
    Thanks again, Christian

  • Please I need help in java oracle.apps.per.DataInstall

    Hi all
    Please can any body help me , when I try to run datainstall to prepare add hrglobal patch by using this command:
    java oracle.apps.per.DataInstall thin hostname:dbport:oraclesid
    but I got this error :
    Data Install java.sql.SQLException: Io exception: Got minus one from a read call
    Regards

    Hi,
    Please mention the application release along with the database version and OS.
    Are you running the command as applmgr user and after sourcing the application env file?
    java oracle.apps.per.DataInstall thin hostname:dbport:oraclesidAre you passing the apps username/password to the command?
    java oracle.apps.per.DataInstall <apps username> <apps password> thin <host:port:sid>
    Latest Oracle HRMS Legislative Data Patch Available (HR Global / hrglobal) [ID 145837.1]
    Please see the suggested solutions in these docs.
    Application Of Patch 5404886 Fails During AK Load Session Error: 17002 Io Exception: Got Minus One From A Read Call [ID 404313.1]
    Unable to connect jdeveloper to 11.5.10 instance [ID 294685.1]
    Thanks,
    Hussein

  • Java oracle.apps.xdo.oa.util.XDOLoader  - BI Publisher 5.6.3 in EBS 11i/r12

    Hello,
    I have gone through the metalini note 469585.1 and found following.
    java oracle.apps.xdo.oa.util.XDOLoader \
    DOWNLOAD \
    -DB_USERNAME apps \
    -DB_PASSWORD apps \
    -JDBC_CONNECTION ap000sun:1521:apps115 \
    -LOB_TYPE TEMPLATE \
    -APPS_SHORT_NAME XDO \
    -LOB_CODE XDOTMPL1 \
    -LANGUAGE ja \
    -TERRITORY JPout of above, How can I find out JDBC_CONNECTON details on my Oracle EBS instance?
    Thanks,
    R

    Hi,
    From the DBC files under $FND_TOP/secure directory.
    JDBC_CONNECTION ap000sun:1521:apps115 --> this represents the database hostname/domain, database port number and SID respectively.
    Thanks,
    Hussein

  • Using Java oracle.spatial.util.SampleShapefileToJGeomFeature : ESRI SHP

    Hi,
    I am trying to import an ESRI shapefile using the Java class oracle.spatial.util. I have to add a remark, that I have set the classpath with the command
    set classpath=.;%ORACLE_HOME%\jdbc\lib\ojdbc14.jar
    I am using Oracle 11g and I don't have this file in the LIB library, only
    ojdbc5.jar
    ojdbc5dms.jar
    ojdbc5dms_g.jar
    ojdbc5_g.jar
    ojdbc6.jar
    ojdbc6dms.jar
    ojdbc6dms_g.jar
    ojdbc6_g.jar
    set classpath=.;%ORACLE_HOME%\md\jlib\sdoapi.jar (file exists)
    set classpath=.;%ORACLE_HOME%\md\jlib\sdoutl.jar (file exists)
    set classpath=.;%ORACLE_HOME%\lib\xmlparserv2.jar (file exists)
    java oracle.spatial.util.SampleShapefileToJGeomFeature -h nt-topobase -p 1521 -s ORCL -u rlv -d admin -t dkn -f KO_shp - 5000000 -g geom
    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/spatial/util/S
    ampleShapefileToJGeomFeature
    Caused by: java.lang.ClassNotFoundException: oracle.spatial.util.SampleShapefile
    ToJGeomFeature
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    I am not sure, why I am getting those errors.

    hi,
    I dont know how to use the SampleShapefileToJGeomFeature Java Class. I have tried 2 syntax
    oracle@oraclesig:/$ java -cp $clpath oracle.spatial.util.SampleShapefileToJGeomFeature -h http://localhost -p 1521 -s SIG -u my_user -d my_pass_word -t my_shape -f /home/oracle/perso/topo/my_shape -r 4326 -g geom
    Parameters:
    <Filename>: File name of an input Shapefile (without extension)
    <Table name>: Table name for the result
    \[SRID\]: Valid Oracle SRID for coordinate system; use 0 if unknown
    <ID Column name>: Column name for unique numeric ID; if required
    oracle@oraclesig:/$ java -cp $clpath oracle.spatial.util.SampleShapefileToJGeomFeature /home/oracle/perso/topo/ma_couche ma_couche 2154 id_com
    Connecting to DB...
    java.sql.SQLException: Exception d'E/S: The Network Adapter could not establish the connection
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
    at java.sql.DriverManager.getConnection(DriverManager.java:582)
    at java.sql.DriverManager.getConnection(DriverManager.java:185)
    at oracle.spatial.util.SampleShapefileToJGeomFeature.main(SampleShapefileToJGeomFeature.java:110)
    Dropping old table...
    Exception in thread "main" java.lang.NullPointerException
    at oracle.spatial.util.SampleShapefileToJGeomFeature.prepareTableForData(SampleShapefileToJGeomFeature.java:252)
    at oracle.spatial.util.SampleShapefileToJGeomFeature.main(SampleShapefileToJGeomFeature.java:129)
    Can you help me for the syntaxe oh the commande?
    Thanks! Regards.
    Ben.
    Edited by: user12240435 on Dec 15, 2009 12:59 AM

  • I am new to this and a bit rusty with Java, Oracle, Web Development, et al; and, I need a free trial run at this time, Can we do this?

    I am new to this and a bit rusty with Java, Oracle, Web Development, et al; and, I need a free trial run at this time, Can we do this?

    your itunes accoutn have nothing to d with your computer
    you can go to any computer with internet access in the world and
    login into your itunes account if you have the appleID and password
    the itunes account is placed on apples itunes servers

  • Simple Java Oracle Interaction

    I am completely new to using Java to access Oracle. I have a very simple project and everything I can find on Java/Oracle interaction seems much more complex than my needs.
    Simply put, I need to query my DB (oracle10g) and gather the results into a JTable. That is it. What would be very useful is something like Sun provides with their API Specifications, but for the Oracle commands I would need to implement this. Can anyone point me in the right direction??
    Finally, in order to access and oracle DB from Java, must I be developing in J2EE, or will regular old Java do the trick??
    Thanks in Advanced
    J Warden

    J,
    If you downloaded the entire JDK (from SUN), it contains some sample code on how to connect a "JTable" to a database. Look in the "demo\jfc\TableExample" subdirectory (of your JDK installation).
    Oracle provides lots of sample code, as well. Have you looked at the JDBC page of the OTN Web site?
    No, you don't need to use J2EE.
    Good Luck,
    Avi.

  • How to do the following XML/XSLT operation in a Java Oracle function?

    I'd like to write a Java method with the following signature...
    public static oracle.xdb.XMLType bwdtransform(java.lang.String suname, oracle.sql.CLOB documentText)
    The documentText is simply a CLOB that contains the XML. It needs to have two XSLT stylesheets applied to it, then made into an XMLType and returned.
    Another requirement is that the stylesheets have to have the Java XPath extensibility, which is available using the namespace "xmlns:java.lang.String="http://www.oracle.com/XSL/Transform/java/java.lang.String".
    I've tried a couple of different ways using oracle.xdb.XMLType.transform() and the classes in the oracle package oracle.xml.parser.v2.*, which is what the listing I pasted in below is based on, but I haven't been able to get anything to work. I THINK the XMLType.transform failed because I was using the Java XPath extensions.
    I'd appreciate it if there's a standard Oracle recommended way to do this operation, preferably as optimized as possible.
    Here btw is the current code I'm using which isn't working. Any variables that you see that aren't initialized in the function are static to the class and initialized in a static {} block including the stylesheets which are instances of XSLStylesheet.
    public static XMLType bwdtransform(java.lang.String suname, oracle.sql.CLOB documentText) throws Exception {
    parser.parse(new ByteArrayInputStream(clobToString(documentText).getBytes()));
    XMLDocument documentTextXMLDocument = parser.getDocument();
    XMLDocumentFragment docFrag = processor.processXSL(twiddlerXSLStylesheet, processor.processXSL(adopterXSLStylesheet, documentTextXMLDocument));
    Document intermediateDoc = docFrag.getOwnerDocument();
    XMLType x = new XMLType(conn, intermediateDoc);
    return x;
    I haven't been able to find any way to make this work and any any help in that direction would be oh so greatly appreciated.
    For completeness, here's the version of Oracle I'm running, according to sqlplus...
    SQL*Plus: Release 11.1.0.7.0 - Production on Thu Apr 30 20:24:53 2009
    Thanks!
    Ralph

    The XMLDB way of doing this like this would be something like the following examples:
    SELECT XMLtransform(x.xmlcol,
              DBURIType('/XDB/STYLESHEET_TAB/ROW[ID=1]
                               /STYLESHEET/text()').getXML()).getStringVal()
           AS result
    FROM  po_tab x; or
    SELECT XMLtransform(x.xmlcol,
                (SELECT stylesheet FROM stylesheet_tab WHERE id=1)).getStringVal()
              AS result
    FROM  po_tab x; or use DBMS_XSLPROCESSOR...

  • CLOB / Charset / Java / Unix Issue

    Hi,
    I'm encountering the following problem.
    I'm working on a 3-tiers architecture with an Oracle Database (8.1.7)
    a Weblogic application server 6.1 SP4 and a Web server under Aix 4.3
    (all 3 are under AIX 4.3 on the same platform).
    My application has a web interface that allows users to upload files
    to the server from their PC clients and a webbrowser, that insert each
    file into a oracle Clob (via Java Code) and that call a stored
    procedure (with java code again) to extract this clob to a file
    (UTL_file package), then, the extracted file is processed line by line
    and information inserted in others tables.
    The issue is that some characters (acute, grave accent ....etc)
    appears as question marks in the database or that some date from the
    file can't be processed because they are structured as DD/MM/YYYY
    (french notation, but that normal I'm from france).
    I first thougt of an NLS_LANG problem but on the weblogic server it is
    set to french_france.WE88859P15 that seems to be right and the same
    the database configuration.
    I then tried to performs some conversion when the clob data were
    extracted to file (from WE88859P15 TO CP152 or vice-versa) with the
    oracle convert function but it seems that it doesn't work.
    An other but coherent symptoms is that the extracted files (from the
    clob columns) seems not to be fine (accent are not recognized).
    This is the java code used to load file to clob (on the weblogic
    server side)
    con = dbHandle.getAdminConnection();
    con.setAutoCommit(false);
    /// NEW IMPORT
    // int taskId = DBTools.getOraSeqValue("vtr.VTR_SEQ_LOG_IMPORT",
    DBTools.NEXTVAL,con);
    int taskId = DBTools.getOraSeqValue(SqlQueryDefinition.seqLogImport.toString(),
    DBTools.NEXTVAL,con);
    Debug.out.println("taskId " + taskId);
    // String cmd = "insert into vtr.vtr_log_import
    (cod_task,DTE_DEBUT,lob_imp,lob_rej,lob_log, txt_nom_fic_orig,
    txt_utilisateur) " +
    // "values ("+ taskId
    +",sysdate,empty_clob(),empty_clob(),empty_clob(), '"+file+"','"+
    ((UserBean)request.getSession().getAttribute("userbean")).getIdentifier()+"')";
    // stmt = con.createStatement();
    // stmt.executeQuery(cmd);
    // stmt.close();
    pstmt = con.prepareStatement(SqlQueryDefinition.initLigneImport.toString());
    pstmt.setInt(1,taskId);
    pstmt.setString(2,file);
    pstmt.setString(3,((UserBean)request.getSession().getAttribute("userbean")).getIdentifier());
    pstmt.executeQuery();
    pstmt.close();
    con.commit();
    // Writing CLOB
    // cmd = "SELECT cod_task,lob_imp,lob_rej,lob_log FROM
    vtr.vtr_log_import WHERE cod_task="+ taskId +" for update";
    // stmt = con.createStatement();
    // rset = stmt.executeQuery(cmd);
    pstmt = con.prepareStatement(SqlQueryDefinition.setBlobImport.toString());
    pstmt.setInt(1,taskId);
    rset = pstmt.executeQuery();
    rset.next();
    File csvFile = new File(localFile);
    System.out.println("csvFile length = " + csvFile.length());
    File unixFile = new File(localFile+".ux");
    Tools.dos2Unix(csvFile, unixFile);
    FileInputStream instream = new FileInputStream(unixFile);
    // support Weblogic
    clob = ClobComponent.factory(DBUtil.getInstance().isWebLogicPlatform());
    clob.setClob(rset,2);
    outstream = clob.getAsciiOutputStream();
    size = clob.getBufferSize();
    byte[] buffer = new byte[size];
    int length = -1;
    while ((length = instream.read(buffer)) != -1)
    outstream.write(buffer, 0, length);
    instream.close();
    outstream.close();
    rset.close();
    // stmt.close();
    pstmt.close();
    rset=null;
    // stmt = null;
    pstmt=null;
    con.commit();
    // IMPORT
    cs = con.prepareCall(SqlQueryDefinition.importStoredProc.toString());
    index = 1;
    cs.setString(index++, fullPath); // 1
    cs.setString(index++,
    ((UserBean)request.getSession().getAttribute("userbean")).getIdentifier());
    // 2
    cs.registerOutParameter(index++,java.sql.Types.VARCHAR); // 3
    cs.registerOutParameter(index++,java.sql.Types.VARCHAR); // 4
    cs.registerOutParameter(index++,java.sql.Types.NUMERIC); // 5
    cs.setInt(index++, taskId); // 6
    cs.executeQuery();
    String fichier1 = cs.getString(3);
    String fichier2 = cs.getString(4);
    int returnCode = cs.getInt(5);
    System.out.println("returnCode/fichier1/2 : " + returnCode + " & "
    + fichier1 + " & " + fichier2);
    cs.close();
    con.commit();
    This is the PL/SQL code used to unload clob to dile (on the oracle
    side)
    PROCEDURE writeToFile (id NUMBER, a_fichier VARCHAR2)
    IS
    result CLOB;
    cvl_tmp VARCHAR2 (32000);
    nvl_amount NUMBER := 250;
    nvl_pos NUMBER := 1;
    nvl_clob_length NUMBER;
    instr_pos NUMBER;
    file_handle UTL_FILE.file_type;
    BEGIN
    file_handle := UTL_FILE.FOPEN(
    substr(a_fichier, 1, instr(a_fichier, file_separator, -1,
    1)-1), -- dir
    substr(a_fichier, instr(a_fichier, file_separator, -1, 1)+1),
    -- file
    'W');
    select lob_imp
    INTO result
    from vtr_log_import
    where cod_task = id;
    --write clob to file
    nvl_clob_length := DBMS_LOB.getlength (result);
    cvl_tmp := NULL;
    nvl_amount := 250;
    nvl_pos := 1;
    LOOP
    instr_pos :=
    DBMS_LOB.INSTR (result, CHR (10), nvl_pos, 1) -
    nvl_pos;
    --DBMS_OUTPUT.PUT_LINE(nvl_pos||': Of length : '||instr_pos);
    IF nvl_pos + instr_pos > nvl_clob_length
    THEN
    instr_pos := nvl_clob_length - nvl_pos;
    DBMS_LOB.READ (
    lob_loc=> result,
    amount=> instr_pos,
    offset=> nvl_pos,
    buffer=> cvl_tmp
    EXIT;
    END IF;
    DBMS_LOB.READ (
    lob_loc=> result,
    amount=> instr_pos,
    offset=> nvl_pos,
    buffer=> cvl_tmp
    -- DBMS_OUTPUT.PUT_LINE(cvL_tmp);
    cvl_tmp := CONVERT(cvl_tmp, 'WE8MSWIN1252', 'WE8ISO8859P15');
    UTL_FILE.put_line (file_handle, cvl_tmp);
    nvl_pos := nvl_pos
    + instr_pos
    + 1;
    IF nvl_pos > nvl_clob_length
    THEN
    EXIT;
    END IF;
    END LOOP;
    UTL_FILE.fclose (file_handle);
    END writeToFile;
    I'm using the oracle thin driver but it's not set in classpath maybe a
    problem with that ?
    <JDBCConnectionPool DriverName="oracle.jdbc.driver.OracleDriver"
    InitialCapacity="1" MaxCapacity="100" Name="oracleUserPool"
    Password="XXXXXXX
    Properties="user=vtr_usr;dll=ocijdbc8;protocol=thin"
    Targets="myserver" TestConnectionsOnRelease="true"
    TestConnectionsOnReserve="true" TestTableName="dual"
    URL="jdbc:oracle:thin:@localhost:1521:ssr"/>
    Maybe a problem with the properties of weblogic.codeset (I don"t set
    it) ?
    Many thanks in advance, I have no idea even if I suspect the java
    store to file or the UTL_file extration to file steps to be in cause !
    Run-O

    Run-O wrote:
    Hi,
    I'm encountering the following problem.Hi. The first thing I'd do to narrow the search is to see if my Java code
    worked in a standalone program, without weblogic in the picture. Once
    you get Oracle's JDBC driver to work with Oracle's DBMS, it shouldn't
    be hard to get the same stuff to work inside weblogic, or find out why it
    doesn't.
    Joe
    >
    >
    I'm working on a 3-tiers architecture with an Oracle Database (8.1.7)
    a Weblogic application server 6.1 SP4 and a Web server under Aix 4.3
    (all 3 are under AIX 4.3 on the same platform).
    My application has a web interface that allows users to upload files
    to the server from their PC clients and a webbrowser, that insert each
    file into a oracle Clob (via Java Code) and that call a stored
    procedure (with java code again) to extract this clob to a file
    (UTL_file package), then, the extracted file is processed line by line
    and information inserted in others tables.
    The issue is that some characters (acute, grave accent ....etc)
    appears as question marks in the database or that some date from the
    file can't be processed because they are structured as DD/MM/YYYY
    (french notation, but that normal I'm from france).
    I first thougt of an NLS_LANG problem but on the weblogic server it is
    set to french_france.WE88859P15 that seems to be right and the same
    the database configuration.
    I then tried to performs some conversion when the clob data were
    extracted to file (from WE88859P15 TO CP152 or vice-versa) with the
    oracle convert function but it seems that it doesn't work.
    An other but coherent symptoms is that the extracted files (from the
    clob columns) seems not to be fine (accent are not recognized).
    This is the java code used to load file to clob (on the weblogic
    server side)
    con = dbHandle.getAdminConnection();
    con.setAutoCommit(false);
    /// NEW IMPORT
    // int taskId = DBTools.getOraSeqValue("vtr.VTR_SEQ_LOG_IMPORT",
    DBTools.NEXTVAL,con);
    int taskId = DBTools.getOraSeqValue(SqlQueryDefinition.seqLogImport.toString(),
    DBTools.NEXTVAL,con);
    Debug.out.println("taskId " + taskId);
    // String cmd = "insert into vtr.vtr_log_import
    (cod_task,DTE_DEBUT,lob_imp,lob_rej,lob_log, txt_nom_fic_orig,
    txt_utilisateur) " +
    // "values ("+ taskId
    +",sysdate,empty_clob(),empty_clob(),empty_clob(), '"+file+"','"+
    ((UserBean)request.getSession().getAttribute("userbean")).getIdentifier()+"')";
    // stmt = con.createStatement();
    // stmt.executeQuery(cmd);
    // stmt.close();
    pstmt = con.prepareStatement(SqlQueryDefinition.initLigneImport.toString());
    pstmt.setInt(1,taskId);
    pstmt.setString(2,file);
    pstmt.setString(3,((UserBean)request.getSession().getAttribute("userbean")).getIdentifier());
    pstmt.executeQuery();
    pstmt.close();
    con.commit();
    // Writing CLOB
    // cmd = "SELECT cod_task,lob_imp,lob_rej,lob_log FROM
    vtr.vtr_log_import WHERE cod_task="+ taskId +" for update";
    // stmt = con.createStatement();
    // rset = stmt.executeQuery(cmd);
    pstmt = con.prepareStatement(SqlQueryDefinition.setBlobImport.toString());
    pstmt.setInt(1,taskId);
    rset = pstmt.executeQuery();
    rset.next();
    File csvFile = new File(localFile);
    System.out.println("csvFile length = " + csvFile.length());
    File unixFile = new File(localFile+".ux");
    Tools.dos2Unix(csvFile, unixFile);
    FileInputStream instream = new FileInputStream(unixFile);
    // support Weblogic
    clob = ClobComponent.factory(DBUtil.getInstance().isWebLogicPlatform());
    clob.setClob(rset,2);
    outstream = clob.getAsciiOutputStream();
    size = clob.getBufferSize();
    byte[] buffer = new byte[size];
    int length = -1;
    while ((length = instream.read(buffer)) != -1)
    outstream.write(buffer, 0, length);
    instream.close();
    outstream.close();
    rset.close();
    // stmt.close();
    pstmt.close();
    rset=null;
    // stmt = null;
    pstmt=null;
    con.commit();
    // IMPORT
    cs = con.prepareCall(SqlQueryDefinition.importStoredProc.toString());
    index = 1;
    cs.setString(index++, fullPath); // 1
    cs.setString(index++,
    ((UserBean)request.getSession().getAttribute("userbean")).getIdentifier());
    // 2
    cs.registerOutParameter(index++,java.sql.Types.VARCHAR); // 3
    cs.registerOutParameter(index++,java.sql.Types.VARCHAR); // 4
    cs.registerOutParameter(index++,java.sql.Types.NUMERIC); // 5
    cs.setInt(index++, taskId); // 6
    cs.executeQuery();
    String fichier1 = cs.getString(3);
    String fichier2 = cs.getString(4);
    int returnCode = cs.getInt(5);
    System.out.println("returnCode/fichier1/2 : " + returnCode + " & "
    + fichier1 + " & " + fichier2);
    cs.close();
    con.commit();
    This is the PL/SQL code used to unload clob to dile (on the oracle
    side)
    PROCEDURE writeToFile (id NUMBER, a_fichier VARCHAR2)
    IS
    result CLOB;
    cvl_tmp VARCHAR2 (32000);
    nvl_amount NUMBER := 250;
    nvl_pos NUMBER := 1;
    nvl_clob_length NUMBER;
    instr_pos NUMBER;
    file_handle UTL_FILE.file_type;
    BEGIN
    file_handle := UTL_FILE.FOPEN(
    substr(a_fichier, 1, instr(a_fichier, file_separator, -1,
    1)-1), -- dir
    substr(a_fichier, instr(a_fichier, file_separator, -1, 1)+1),
    -- file
    'W');
    select lob_imp
    INTO result
    from vtr_log_import
    where cod_task = id;
    --write clob to file
    nvl_clob_length := DBMS_LOB.getlength (result);
    cvl_tmp := NULL;
    nvl_amount := 250;
    nvl_pos := 1;
    LOOP
    instr_pos :=
    DBMS_LOB.INSTR (result, CHR (10), nvl_pos, 1) -
    nvl_pos;
    --DBMS_OUTPUT.PUT_LINE(nvl_pos||': Of length : '||instr_pos);
    IF nvl_pos + instr_pos > nvl_clob_length
    THEN
    instr_pos := nvl_clob_length - nvl_pos;
    DBMS_LOB.READ (
    lob_loc=> result,
    amount=> instr_pos,
    offset=> nvl_pos,
    buffer=> cvl_tmp
    EXIT;
    END IF;
    DBMS_LOB.READ (
    lob_loc=> result,
    amount=> instr_pos,
    offset=> nvl_pos,
    buffer=> cvl_tmp
    -- DBMS_OUTPUT.PUT_LINE(cvL_tmp);
    cvl_tmp := CONVERT(cvl_tmp, 'WE8MSWIN1252', 'WE8ISO8859P15');
    UTL_FILE.put_line (file_handle, cvl_tmp);
    nvl_pos := nvl_pos
    + instr_pos
    + 1;
    IF nvl_pos > nvl_clob_length
    THEN
    EXIT;
    END IF;
    END LOOP;
    UTL_FILE.fclose (file_handle);
    END writeToFile;
    I'm using the oracle thin driver but it's not set in classpath maybe a
    problem with that ?
    <JDBCConnectionPool DriverName="oracle.jdbc.driver.OracleDriver"
    InitialCapacity="1" MaxCapacity="100" Name="oracleUserPool"
    Password="XXXXXXX
    Properties="user=vtr_usr;dll=ocijdbc8;protocol=thin"
    Targets="myserver" TestConnectionsOnRelease="true"
    TestConnectionsOnReserve="true" TestTableName="dual"
    URL="jdbc:oracle:thin:@localhost:1521:ssr"/>
    Maybe a problem with the properties of weblogic.codeset (I don"t set
    it) ?
    Many thanks in advance, I have no idea even if I suspect the java
    store to file or the UTL_file extration to file steps to be in cause !
    Run-O

  • Java, Oracle, and Arabic Characters

    Hi,
    I need to run some Forms fmb files that contain Arabic characters through Oracle's forms to xml converter (frmf2xml.bat). The XML that is generated by the utility contains strings such as "رقم الموظ�" instead of the Arabic characters I was expecting.
    The XML output by frmf2xml.bat is encoded as UTF-8.
    My NLS_LANG is set to AMERICAN_AMERICA.UTF8. The characters display fine in Forms Builder.
    Is there another localization setting I need to make with the conversion utility or even with Java itself?
    Any insight or comments appreciated.
    Dave

    On a related note, I am seeing a couple of different types of 'incorrect' characters based on different NLS_LANG settings.
    If it is set to AMERICAN_AMERICA.UTF8, I get characters like this:
    رقم الموظ�
    If it is set to ARABIC_UNITED ARAB EMIRATES.AR8MSWIN1256, I get characters like this:
    ÑÞã ÇáãæÙÝ
    Do any of you know what these characters are?
    Thanks for any insight.

  • ProLiant DL360p Gen8 problem with java/oracle

    we are using OPERA PMS in a new single server , windows server 2008 r2 x64. From the first day we are getting these 2 weird errors ( attached )
    I have tried re-install network cards,changing cables,re-installing java,disabling antivirus,changing networkretries=30 on oracle etc
    is it hardware or software problem u think?
    p.s. having problems uploading photos....
    http://tinypic.com/r/a0gb9h/5
    http://tinypic.com/r/2mqrfav/5

    contact the software vendor

  • Java-oracle-java encryption-decryption error.

    Hi
    We have a program which encrypts strings using DES and writes the encrypted to an oracle data. The code is similar to the following:
    private static String encrypt(String property) throws GeneralSecurityException {
    SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("PBEWithMD5AndDES");
    SecretKey key = keyFactory.generateSecret(new PBEKeySpec(PASSWORD));
    Cipher pbeCipher = Cipher.getInstance("PBEWithMD5AndDES");
    pbeCipher.init(Cipher.ENCRYPT_MODE, key, new PBEParameterSpec(SALT, 20));
    return base64Encode(pbeCipher.doFinal(property.getBytes()));
    This works consistently across jvms / os / hw / etc.
    Unfortunately, the original version was writing it to the db as strings and now, these can't be de-crypted as oracle returns different values from the column.
    I was wondering whether there was any way of retrieving these values now.
    Regards
    V
    Edited by: user10510492 on Sep 28, 2011 1:59 PM

    You need to try to find out what characterset was originally used to create the strings, this was either specified explicitly in the code, or done with the default Java encoding for your platform. Unfortunately there still is potential for loss of information which might prevent you from correctly decrypting the string (eg, bytes not in the characterset might have been converted to a questionmark, ASCII controlcodes might have been converted to something safer by your database, etc).

  • Change charset in Oracle 10g XE

    How do I change the charset to WE8ISO8859P1 in Oracle 10g XE ?
    thanks in advanced

    How do I change the charset to WE8ISO8859P1 in Oracle 10g XE ?Not easily.
    Change to what?

  • Want in implement Java oracle Forms.

    Hi,
    I want to learn how to implement java in oracle form, and that to I want it using oracle forms builder and not using Jbuilder.
    E.g. implementing Java Beans in oracle forms.
    As I am a begineer in this field, please guilde me from where I should start and what I should read for this.
    Thanks,
    Ashish

    If you talk about creating Java components for Forms, you can't avoid using a Java IDE - but Oracle has JDeveloper, and it's free! :) What you need is basic knowledge about Java and how Forms can interact with Java components, and the links from Francois should give you a good starting point for that.
    You can also find a lot of inspiration of what you can do with Java in Forms at Francois' blog:
    http://fdegrelle.over-blog.com/
    Hope this helps,
    Jacob

  • Special characters in java, oracle and html

    Hi,
    I'm working on a mini content management system and need help with dealing with special characters.
    The input are taken from html form which are then stored into a varchar column in oracle database.
    When i retrieve the data, some of the special characters have been changed to ??? and also
    fields with double quote are modified.
    I believe there two issues;
    1. dealing with special characters
    2. display special characters back in html form textfield after retrieving.
    e.g.
    This is the line with "quote" saved to database
    This is the line with "quote" retrieved from database
    This is the line with displayed in html text field.
    Any help will be much appreciated.
    Thanks in advance.

    Maybe you should try this couple of classes: java.net.URLDecoder and java.net.URLEncoder
    Andres
    Best

Maybe you are looking for

  • Kanban - External procurement with multiple vendor

    Hi Gurus, We are working on implementation of Kanban for external procurement (Scheduling agreement) in my organisation. As per the business requirement, some of the components are supplied by more than one vendor. As per the standard process, Kanban

  • Combining user Keychain with login Keychain

    Just recently did a Erase and Install upgrade to Leopard on my G5 and restored my previous Keychain Access data via Backup and my MobileMe account. This has created a separate Keychain file in my user/Library/Keychain folder with my user name, result

  • Installing Mac OS X Leopard DVD on emac running 10.3.9

    Hi I have purchased a Mac OS X Leopard DVD from the Apple store but every time I insert into my mac it pops back out? I have checked whether or not it is a DVD issue and it is not as all other DVD's (except for the Leopard, I've tried work! It is the

  • Itunes 11 "add to library" not working (drag and drop too)

    I just updated to itunes 11 and the add to library function is not working both manually and drag and drop.  I used to be able to add a video to the itunes media file, click add to library, click the file and it would pull it in to itunes.  None of t

  • 15" UMBP 2.53 - 6GB RAM Configuration

    So I originally purchased 2x2GB from Apple with my UMBP, and I have since tried to purchase the 4GB module from OWC to try and go to 6GB. I installed the 4GB module and the machine booted no problem, but would soon lock up with the blackened screen a