Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

problem to insert persian text in mySql

  Asked By: James    Date: Apr 01    Category: Java    Views: 1629
  

When I want to insert a persian text in one of my records,I have an error with
this content:
INSERT INTO category VALUES(id,'مهدی ');
error1406:
Data too long for column 'Name' at row 1.
My table charset is utf8 and my collation is utf8_persian_ci .

Share: 

 

3 Answers Found

 
Answer #1    Answered By: Janelle Evans     Answered On: Apr 01

I got your problem, while adding the record in the database no matter of what language data  is going to be inserted so try by changing the field data type as varchar it will work u fine

 
Answer #2    Answered By: Lela Lynch     Answered On: Apr 01

i think you can use i18n in your peroject or programm. wit this prperty you can use every language in your database or everywhere

 
Answer #3    Answered By: Mark R     Answered On: Apr 01

If you have persistence.xml file in your project and you're using ORM framework like hibernate or toplink
<property name="toplink.jdbc.url" value="jdbc:mysql://localhost:3306/SCHEMA_NAME?characterEncoding=UTF-8" />

Otherwise in your code when you want to create a connection (JDBC) you have change your URL address.
I think using ?characterEncoding=UTF-8 will solve your problem

 
Didn't find what you were looking for? Find more on problem to insert persian text in mySql Or get search suggestion and latest updates.




Tagged: