If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > JAVA > insert character Ņ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-16-08, 17:33
dr_pompeii dr_pompeii is offline
Registered User
 
Join Date: Jan 2008
Posts: 22
Question 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 PIŅON',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 PIŅON
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
Reply With Quote
  #2 (permalink)  
Old 01-17-08, 03:13
healdem healdem is online now
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
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
Reply With Quote
  #3 (permalink)  
Old 01-17-08, 06:48
dr_pompeii dr_pompeii is offline
Registered User
 
Join Date: Jan 2008
Posts: 22
healdem
thanks for the reply

Quote:
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?

Quote:
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
Reply With Quote
  #4 (permalink)  
Old 01-17-08, 09:13
healdem healdem is online now
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
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
Reply With Quote
  #5 (permalink)  
Old 01-17-08, 10:37
dr_pompeii dr_pompeii is offline
Registered User
 
Join Date: Jan 2008
Posts: 22
Hello healdem

thanks so much for your reply

Quote:
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 NIŅITA AND GIRL IS NIŅA',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 NIŅITA AND GIRL IS NIŅA |
+------------+----------------------------------------------------+
1 row in set (0.00 sec)

mysql>
Quote:
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
for the bold part, how i can resolve this?

thanks in advanced
Reply With Quote
  #6 (permalink)  
Old 01-17-08, 12:41
healdem healdem is online now
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
Quote:
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
Reply With Quote
  #7 (permalink)  
Old 01-21-08, 06:00
Marvels Marvels is offline
Registered User
 
Join Date: Jul 2003
Location: Amsterdam, Nederland
Posts: 449
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On