MySql / Oracle special characters

Searched all around, my apologies if this is a redundant thread.
I have an Oracle (10.2.0.3) database set up to connect to MySql (4.1) database using HSODBC. Using the 3.51 MySql driver. Has a couple bugs. Distributed transactions, erroneous record counts, etc -- but I know from reading other threads that the fixes are coming. There is one problem I can't seem to get around...
In MySql, a certain field is defined as CHAR(40). I would think any content short of 40 characters is padded with spaces. But when I pull pipeline characters concatenated on both sides of the values (MySql query browser), there are no extra spaces. It's behaving more like a VARCHAR on the MySql end:
[select concat( '|', field, '|') from table]
returns '|value|'
NOT '|value |'
Now, when I pull this data through to Oracle, there are special characters padding the content to the length of the column. When I pull the ASCII code value, they're 0 NUL (null) characters. Every CHAR field in every table that doesn't fill the column is coming across the database link padded with these NUL characters, which look like little hollow squares (in SqlDeveloper and JDeveloper). Since they're not spaces, I can't TRIM them out. I can remove them with TRANSLATE, but I would have to identify every CHAR field in every table and manually code a TRANSLATE into views against the DB_LINK, and then always pull from the views. There must be an easier way to get around this.
Has anybody had a similar experience? Is this the version of the MySql driver (3.51) that I'm using? I see they have a version 5 out now. Is this addressed by a 10.2.0.4 patchset? Is that available yet? (Redhat) Is this fixed with 11g?
Oracle - AL32UTF8, UTF8
MySql - uses both UTF8 and Latin1, but the default on the source table is Latin1 / Latin_swedish_ci

The problem is a MySQL ODBC driver issue.
You have to enable ODBC option 512 (pad char to full length):
Default behaviour of the MySQL ODBC is not to PAD spaces:
SQL> select dump( "col1") from "counter"@mysql;
DUMP("COL1")
Typ=96 Len=20: 72,101,108,108,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
As you can see the char column is padded with 0 instead of spaces (32).
As soon as you add OPTION 512 to the ODBC.INI (please make sure if you already have a value set for OPTION to add 512 on top of your value to get your dedicated value). So the ODBC.INI might look like:
[mysql]
Description = MySQL database test
Driver = /usr/lib/libmyodbc3.so
#Driver = MySQL ODBC 3.51 Driver
OPTION = 512
and then MySQL behaves correctly:
SQL> select dump( "col1") from "counter"@mysql;
DUMP("COL1")
Typ=96 Len=20: 72,101,108,108,111,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32

Similar Messages

  • How to save Special Characters in oracle?

    Is there any way to enter special characters such as ºC ? i am using J2EE and Oracle 9 i.
    When i try to enter 2ºC after updating the datbase it is converted to 2ºC when it is displayed in HTML. All special characters are prefixed with Â. Pls suggest any way to use special characters with oracle ..

    This has nothing do to with NLS_LANGUAGE. In general, character set processing depends on NLS_LANG setting (which is an OS setting and not a instance initialization parameter) and database character set. To understand NLS_LANG see OTN NLS_LANG FAQ http://www.oracle.com/technology/tech/globalization/htdocs/nls_lang%20faq.htm.
    However, I think that JDBC is an exception and does not use the character set defined by NLS_LANG. See last answer in following discussion:
    Re: When is NLS_LANG used ?

  • Oracle SQL query for getting specific special characters from a table

    Hi all,
    This is my table
    Table Name- Table1
    S.no    Name
    1          aaaaaaaa
    2          a1234sgjghb
    3          a@3$%jkhkjn
    4          abcd-dfghjik
    5          bbvxzckvbzxcv&^%#
    6          ashgweqfg/gfjwgefj////
    7          sdsaf$([]:'
    8          <-fdsjgbdfsg
    9           dfgfdgfd"uodf
    10         aaaa  bbbbz#$
    11         cccc dddd-/mnm
    The output has to be
    S.no    Name
    3          a@3$%jkhkjn
    5          bbvxzckvbzxcv&^%#
    7          sdsaf$([]:'
    8          <-fdsjgbdfsg
    10         aaaa  bbbbz#$
    It has to return "Name" column which is having special characters,whereas some special chars like -, / ," and space are acceptable.
    The Oracle query has to print columns having special characters excluding -,/," and space
    Can anyone help me to get a SQL query for the above.
    Thanks in advance.

    You can achieve it in multiple ways. Here are few.
    SQL> with t
      2  as
      3  (
      4  select 1 id, 'aaaaaaaa' name from dual union all
      5  select 2 id, 'a1234sgjghb' name from dual union all
      6  select 3 id, 'a@3$%jkhkjn' name from dual union all
      7  select 4 id, 'abcd-dfghjik' name from dual union all
      8  select 5 id, 'bbvxzckvbzxcv&^%#' name from dual union all
      9  select 6 id, 'ashgweqfg/gfjwgefj////' name from dual union all
    10  select 7 id, 'sdsaf$([]:''' name from dual union all
    11  select 8 id, '<-fdsjgbdfsg' name from dual union all
    12  select 9 id, 'dfgfdgfd"uodf' name from dual union all
    13  select 10 id, 'aaaa  bbbbz#$' name from dual union all
    14  select 11 id, 'cccc dddd-/mnm' name from dual
    15  )
    16  select *
    17    from t
    18   where regexp_like(translate(name,'a-/" ','a'), '[^[:alnum:]]');
            ID NAME
             3 a@3$%jkhkjn
             5 bbvxzckvbzxcv&^%#
             7 sdsaf$([]:'
             8 <-fdsjgbdfsg
            10 aaaa  bbbbz#$
    SQL> with t
      2  as
      3  (
      4  select 1 id, 'aaaaaaaa' name from dual union all
      5  select 2 id, 'a1234sgjghb' name from dual union all
      6  select 3 id, 'a@3$%jkhkjn' name from dual union all
      7  select 4 id, 'abcd-dfghjik' name from dual union all
      8  select 5 id, 'bbvxzckvbzxcv&^%#' name from dual union all
      9  select 6 id, 'ashgweqfg/gfjwgefj////' name from dual union all
    10  select 7 id, 'sdsaf$([]:''' name from dual union all
    11  select 8 id, '<-fdsjgbdfsg' name from dual union all
    12  select 9 id, 'dfgfdgfd"uodf' name from dual union all
    13  select 10 id, 'aaaa  bbbbz#$' name from dual union all
    14  select 11 id, 'cccc dddd-/mnm' name from dual
    15  )
    16  select *
    17    from t
    18   where translate
    19         (
    20            lower(translate(name,'a-/" ','a'))
    21          , '.0123456789abcdefghijklmnopqrstuvwxyz'
    22          , '.'
    23         ) is not null;
            ID NAME
             3 a@3$%jkhkjn
             5 bbvxzckvbzxcv&^%#
             7 sdsaf$([]:'
             8 <-fdsjgbdfsg
            10 aaaa  bbbbz#$
    SQL>

  • Reading and writing Special Characters to Oracle DB

    Hi All,
    I need to insert data from CSV to Oracle DB and then use the same data for creating XML file in UTF-8 format.
    I have few fields in the CSV file which has � and � special characters. I'm able to read � and write in UTF-8 , but the same procedure is resulting in some other ascii character for �.
    While reading data from CSV file :
    Reader l_fileReader = new InputStreamReader(p_in,"ISO-8859-1");
    Can anyone help me.
    Thanks,
    Ramki.

    Does anyone has some pointers or clues?

  • Special Characters in Oracle

    Hi,
    We have a requirement where we need to load data into Oracle . We are creating a CSV file and loading data to Oracle tables using SQL Loader scripts. There are certain records in the CSV Files that have special characters. For example 20°/ 60°/ 85°. The data is coming fine when in the CSV file, but when it is loaded in Oracle tables it is displayed as 20¿/ 60¿/ 85¿. Please share if you have any info on this.
    Character set value:
    SELECT value
    FROM nls_database_parameters
    WHERE parameter ='NLS_CHARACTERSET';
    Result:AL32UTF8
    Regards
    AM

    Hi,
    where do you load those files? On the server or on the client? You have to look at the NLS_LANG setting on the OS. If it is not properly set, then it uses ASCII. So set NLS_LANG properly, or use the CHARACTER keyword in the controlfile of SQLLOADER. More information in the manual: http://download.oracle.com/docs/cd/E11882_01/server.112/e16536/ldr_control_file.htm#i1005287
    Herald ten Dam
    http://htendam.wordpress.com

  • Mysql problem with german special characters

    hi,
    I wrote a software and it worked quite good, but after I installed it on a new machine with j2se 1.4 I've problems with the german special characters.
    this code works good on the old machine (jdk 1.3.1) and prints the wanted characters like �,�,�.
    Class.forName("org.gjt.mm.mysql.Driver").newInstance();
    java.sql.Connection conn;
    conn = DriverManager.getConnection("jdbc:mysql://localhost/testdb?user=testuser&password=xxxx");
    Statement s = conn.createStatement();
    ResultSet r = s.executeQuery("select something from testtb where id='1'");
    r.first();
    System.out.println( r.getString(1) );
    but on the new machine (j2se 1.4) I only receive the character ?.
    I updated my org.gjt.mm.mysql to the current MySQL Connector/J 3.0.9 and added
    conn = DriverManager.getConnection("jdbc:mysql://localhost/testdb?user=testuser&password=xxxx&useUnicode=true&characterEncoding=ISO-8859-1");
    but I've got still the same problem.
    Thanks in advance
    Markus

    with "wanted characters like �,�,�"
    I meant: like &#x00E4;,&#x00FC;,&#x00F6;

  • Load special characters in oracle by using informatica

    Hi All,  I'm trying to load data from flat file to oracle databse table using Informatica power center 9.1.0 and I have some special characters in source file. Data are loaded sucessfully without any errors but these special characters are loaded different way like 1) Planner – loaded as Planner ��������2) Háiréch  loaded as Hair��������ch  While same flatfile loaded into another flatfile,data loaded correctly including special characters.So,I am unable to understand problem with database or informatica.   SourceFlat File - comma ',' delimtedCode page is defined as UTF-8 encoding of Unicode Relational connectionI have tried by changing the code page while creating relational connection in Informatica to UTF-8, ISO 8859-1 Western European,  MS Windows Latin 1 etc.,didn't work. InformaticaIntegration Service and Repo code page is defined as UTF8Data movement code page of Integration server was set to UNICODE   TargetOracle databaseNLS_NCHAR_CHARACTERSET: AL16UTF16NLS_CHARACTERSET: AL32UTF8   ThanksSai

    Hi All,  I'm trying to load data from flat file to oracle databse table using Informatica power center 9.1.0 and I have some special characters in source file. Data are loaded sucessfully without any errors but these special characters are loaded different way like 1) Planner – loaded as Planner ��������2) Háiréch  loaded as Hair��������ch  While same flatfile loaded into another flatfile,data loaded correctly including special characters.So,I am unable to understand problem with database or informatica.   SourceFlat File - comma ',' delimtedCode page is defined as UTF-8 encoding of Unicode Relational connectionI have tried by changing the code page while creating relational connection in Informatica to UTF-8, ISO 8859-1 Western European,  MS Windows Latin 1 etc.,didn't work. InformaticaIntegration Service and Repo code page is defined as UTF8Data movement code page of Integration server was set to UNICODE   TargetOracle databaseNLS_NCHAR_CHARACTERSET: AL16UTF16NLS_CHARACTERSET: AL32UTF8   ThanksSai

  • Special Characters in CONTAINS section of ORACLE TEXT

    Can we have special characters in the CONTAINS Section of the ORACLE TEXT.
    Ex:
    Select count(*) from Table_Name where CONTAINS(Column_Name, '%SearchString#%')>1..
    If I am introductions characters like @,#,$,^,&,*(, ) --> then I am getting error as given below
    ERROR at line 1:
    ORA-29902: error in executing ODCIIndexStart() routine
    ORA-20000: Oracle Text error:
    DRG-51030: wildcard query expansion resulted in too many terms
    Any Suggestions Please.

    Check this
    http://download-east.oracle.com/docs/cd/B10501_01/text.920/a96518/cqspcl.htm#1360

  • Special characters vanish when passed to webservice on Oracle AS 10gR2

    I've created a rpc webservice with an "echo" method. It has a single String parameter and simply returns this parameter. I've been using JDeveloper 10.1.2 and deployed this webservice onto OAS 10gR2 (10.1.2). To access it in client application I used proxy generated by JDeveloper. Problem appears when I pass the value containing special characters like < or >. Echo method receives this value without these characters. So client sends something like <hello> and webservice sends back hello instead of <hello>. I've tried to replace < and > with '& lt;' and '& gt;' but then & character is lost. So from '& lt;hello& gt;' client receives lt;hellogt;.
    This problem doesn't appear when I deploy webservice to Oracle AS 9.0.4 so I suspect it has something to do with AS configuration.
    I would appreciate any help.

    take a look at
    http://www.oracle.com/technology/products/ias/portal/html/javadoc/xml_tag_reference_v2.html
    and look for <escapeOutput> parameter - "Controls whether control characters in the response from the web service (such as '<' and '&') are escaped in the portlet response so that they display in HTML" - the default value is on, meaning special characters are escaped - this parameter applies only to Oracle Portal, but maybe there is a similiar parameter for AS

  • 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

  • ### Problem in retrieving special characters with Oracle 9i JDBC drivers

    hi,
    We are having some problem with retrieving special characters like '�' from the database.
    Our application is using JDK1.3.1 with Oracle 9i at the back end(Version: 9.0.1.0.0). We are using oracle 9i thin drivers (classes12.zip) for database interaction.
    To relieve the data from database we are using PreparedStatement in two ways
    1. Creating a preparedstatement from connection object without any parameters and then retrieve the
    data using it. This gives the results in correct format i.e. special characters like '�'
    2. Create the preparedstatement by passing the following parameters.
    i) ResultSet.TYPE_SCROLL_INSENSITIVE
    ii) ResultSet.CONCUR_READ_ONLY
    In this case we are not able to retrieve the special character like '�' correctly. Instead the ResultSet
    returns 'h'
    I think this is the problem with Oracle drivers. Does anyone have any information about the mentioned problem.
    rgds

    I don't know exactly (because I am using JDK 1.4 with ojdbc14.jar where these problems seem to be rare...) but you may consider this:
    1. Add nls_charset12.zip to your classpath to ensure that the encoders are present (may or may not help)
    2. Swith to JDK 1.4, and do this:
    Instead of String s = getString(column)
    use
    byte[] bytes = getBytes(column);
    ByteBuffer bb = ByteBuffer.wrap(bytes); // in package java.nio
    CharBuffer cb = Charset.forname("ISO-8859-x").decode(bb);
    String s = cb.toString();
    The latter method allows you to perform the encoding/decoding manually.
    3. Change the character encoding in the database to unicode upon database setup.
    4. Try playing with NLS parameters (alter session ...)

  • How to insert & # special characters into oracle table?

    I have a text value which contains special characters such as & and #.
    After I pass from one page to another,
    TEST& becomes "TEST&amp;"
    I put " " on the above test, otherwise amp; will be truncated by OTN).
    TEST# becomes TEST (# is truncated).
    Actually the value is saved in table like this: "TEST&amp;"
    How to solve this problem?
    How to insert & into table without &amp;
    Thank you.
    Edited by: user628655 on Jul 27, 2009 9:47 AM
    Edited by: user628655 on Jul 27, 2009 9:49 AM
    Edited by: user628655 on Jul 27, 2009 10:39 AM

    Avoid doing that through a link. If this is a page item then submit the page and redirect to the target page using a branching. On the target page, create a computation to compute the target item using the original page item as the source. If you are talking about a report, use the id to pass through the link and fetch the text column in an on load computation.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    ------------------------------------------------------------------------------

  • Identify special characters in oracle 9i

    HI,
    I want to identify the special characters in a table.Right now i am using oracle 9i version.
    Please help us.

    You can use following pl/sql block for this purpose. It will check if there is any special character in a field(item description here) and will display that display the position and ascii value of that special character. Later you can write another query(if needed) to remove those special characters.
    Modify the query as needed.
    declare
    l_desc VARCHAR2(90);
    l_length NUMBER;
    l_cnt NUMBER := 1;
    l_char VARCHAR2(20);
    l_spc_char NUMBER := 0;
    CURSOR c1 is select segment1, description, length(description) length1 from mtl_system_items_b where 1=1 rownum < 10000  and segment1 = '00000942304A330'
    and organization_id = 156;
    begin
    FOR c_rec IN C1
    LOOP
    l_cnt := 1;
    l_spc_char := 0;
    WHILE l_cnt <= c_rec.length1
    LOOP
    l_char := SUBSTR(c_rec.description,l_cnt,1);
    IF (ascii(l_char) < 32 or ascii(l_char) > 126) then
    DBMS_OUTPUT.PUT_LINE('Character: '||l_char||' Position: '||l_cnt||' Ascii Value: '||ascii(l_char));
    l_spc_char := l_spc_char + 1;
    end if;
    l_cnt := l_cnt + 1 ;
    END LOOP;
    IF l_spc_char > 0 THEN
    DBMS_OUTPUT.PUT_LINE('Item: '||c_rec.segment1||' Description: '||c_rec.description);
    END IF;
    END LOOP;
    end;

  • Oracle BPM Studio 10g R3 cataloging Web Services strips special characters

    Hi folks,
    I have a Web Service that I'd like to invoke from an activity in my process.
    When I catalog the WSDL, BPM Studio creates the associated External Resource just fine except for one small problem, namely all Simple Types that have 'special characters' in their enumerated String values are stripped clean.
    Example 1:
    ADSL1
    ADSL2
    ADSL2+
    --&gt; The plus is stripped from ADSL2+, causing BPM Studio to flag two problems caused by duplicate 'ADSL' values
    Example 2:
    adsl1#foo/123
    --&gt; Everything to the left of 123 is stripped leaving only '123' as a value
    In fact in the BPM Studio's Editor, the only special character that is allowed is the underscore. Everything else e.g. \ # etc etc cannot be keyed in.
    Has anyone come across this before? Thanks for reading :-)
    cheers
    jm

  • Special characters in a feild in oracle table.

    Hi,
    I want to find out all the special characters in a particular field say name, how am I to do it.
    Can u please help me.
    Regards
    Sridhar

    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 1 as id, 'Fred' as name from dual union all
      2             select 2, 'Bob!' from dual union all
      3             select 3, 'Jimmy123' from dual union all
      4             select 4, '45Tim' from dual union all
      5             select 5, 'Ken5@Thomas.' from dual)
      6  -- end of test data
      7  select id, regexp_replace(name, '[(A-Za-z0-9)]') as special_chrs
      8* from t
    SQL> /
            ID SPECIAL_CHRS
             1
             2 !
             3
             4
             5 @.
    SQL>

Maybe you are looking for