Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2008
    Posts
    22

    Question Unanswered: insert character

    Dear members

    i have this case

    i have somefile.sql used to insert via consola/terminal
    for windows and linux a lot of these sentences
    Code:
    INSERT INTO Articulo
    (idArticulo,descripcion,stockactual,precioUnitario,precioUnitarioVenta,totalValorizado,xtraTextUnoArticulo, xtraNumDosArticulo,idLineaCategoria,idMedida)
    VALUES('MD343636','RODAJE DE PION',0,0,0,0,'',0,'100','10');
    but how you can see i use spanish character like and
    even for other insertions

    now see the name PION
    i dont recieve some error while the insertion, but via browser in my java application i see this row in this way

    Code:
    RODAJE DE PIÑON
    the is lost and replaced by other characters

    how i can resolve this???

    thanks in advanced

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    This sort of issue can be problematic to resolve. Coming from a British English background its not something I've had many dealings with as the default character set works fine for me. So the following is guesswork / distant memory...

    first off make sure the MySQL db is using the correct character set. I forget at what level you need to set it, I think you can define a specific character set at server, db and/or table level.

    the next thing to do is to make sure that all clients support that character set. So the problem may not be a MySQL problem, it may be to do with the client(s) sending/receiving data, it may be the server, it may be at an intermediate level.. if say you are going through a web server, or other form of driver or intermediate process.

    From waht you are saying it sounds like the MySQL is fine.. the problem is the manner in which data is retrieved from the server.... there is one or more intermediate step whoich is not handling the code page correctly.

    whether thats the MySQL class / interface, something in JAVA, something in the final target, or some other piece of software you are using in the application

    Personally I'd suspect its going to be either the JAVA MySQL interface or JAVA itself, if you don't get an answer here I'd suggest you ask the question in the JAVA thread... thinking about it probably best to move this to the JAVA thread leaving it visible in the MySQL thread to give it a better chance oif being answered

    HTH

  3. #3
    Join Date
    Jan 2008
    Posts
    22
    healdem
    thanks for the reply

    first off make sure the MySQL db is using the correct character set. I forget at what level you need to set it, I think you can define a specific character set at server, db and/or table level.
    how i can do that?

    From waht you are saying it sounds like the MySQL is fine.. the problem is the manner in which data is retrieved from the server.... there is one or more intermediate step whoich is not handling the code page correctly.
    i think that the reason is a encoding problem

    i have this situation

    in a submit form i can write in peace any character and even

    but in the db if a do a simple query
    after to done the submit insertion of course
    i lost my spansih character like

    Code:
    mysql> select razonCliente,direccionCliente from Cliente;
    +--------------+------------------+
    | razonCliente | direccionCliente |
    +--------------+------------------+
    | CARLOS NU?EZ | AV LOS NI?OS 108 |
    +--------------+------------------+
    2 rows in set (0.00 sec)
    
    mysql>
    ? instead of , why?



    thanks in advanced

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Id still suggest first off prove where the error is occurring... first off check the server
    try inserting the row (preferably) inside the the MySQL command client or (failing that) the MySQL query browser. I'd sugges tthe command line client so that there are as few as possible barriers between you and the server itself
    if you can insert PIÑON there and see it on a query then you know the error isn't the server.. the data is being stored correctly

    if it is then the problem is how you are submitting the data to the server

    I'd have a look at http://dev.mysql.com/doc/refman/5.0/...onnection.html

  5. #5
    Join Date
    Jan 2008
    Posts
    22
    Hello healdem

    thanks so much for your reply

    try inserting the row (preferably) inside the the MySQL command client or (failing that) the MySQL query browser.
    I'd sugges tthe command line client so that there are as few as possible barriers between you and the server itself
    ok, friend, i did this

    Code:
    @localhost ~]$ mysql -u root -p 
    Enter password:
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 1 to server version: 5.0.27-standard
    
    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
    
    mysql> INSERT INTO Articulo (idArticulo,descripcion,stockactual,precioUnitario,precioUnitarioVenta,totalValorizado,xtraTextUnoArticulo, xtraNumDosArticulo,idLineaCategoria,idMedida) 
    VALUES('ABC','LITTLE GIRL IN SPANISH IS NIITA AND GIRL IS NIA',0,0,0,0,'',0,'100','10');
    Query OK, 1 row affected (0.05 sec)
    
    mysql> select a.idArticulo,a.descripcion from Articulo a WHERE a.idArticulo='ABC';
    +------------+----------------------------------------------------+
    | idArticulo | descripcion                                        |
    +------------+----------------------------------------------------+
    | ABC        | LITTLE GIRL IN SPANISH IS NIITA AND GIRL IS NIA |
    +------------+----------------------------------------------------+
    1 row in set (0.00 sec)
    
    mysql>
    if you can insert PION there and see it on a query then you know the error isn't the server.. the data is being stored correctly

    if it is then the problem is how you are submitting the data to the server
    for the bold part, how i can resolve this?

    thanks in advanced

  6. #6
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    how i can resolve this?
    I don't know, I don't use JAVA, I don't use the none default codepage in mySQL

    So the server is storing and retrieving your data correctly, now youneed to trace where the error is being introduced. It could be the JAVA / MYSQL interface, it could be the JAVA application

    I'd check to see if the MySQL Query browser displays the data correctly.. if so that narrows it down to something that is JAVA specific

    check what code page your Java app is using
    check what code page you Java -> MySQL library / class is using

    have you checked to make sure you are suing he most recent and stable JAVA interface?


    the problem lies in the Java area, not the MySQL server

  7. #7
    Join Date
    Jul 2003
    Location
    Amsterdam, Nederland
    Posts
    450

    Re

    Both your Database and develop enviroment should support Cirilic characters

    See google on how you can set up your enviroment's for this
    Greetz Marvels -^.^-
    Developments : VB4 Through .Net; Basic; DOS ; CNC ; Sinclair
    Databases : SQL Server Through 2005; Access 3 Through 2003 ; Oracle 8 & 9.i ;
    OS : Win 3.11 Through XP ; NortonComander ; DOS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •