Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Adding Marathi words to MySQL table

  1. #1
    Junior Member
    Join Date
    Nov 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Adding Marathi words to MySQL table

    Hi...
    I am working on project related to localization.I want to add marathi text to mysql table.But when i add it through jsp page it shows garbage values.Can u suggest any solution to this problem.
    Thank you.
    Last edited by vaishali; November 12th, 2008 at 02:48 AM.


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: How to add marathi words to mysql table

    Hello vaishali.

    Welcome to the Java Programming Forums.

    Can you please post the code that you have written.
    It will be near impossible to diagnose your problem without it..

    Thanks.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  3. #3
    Junior Member
    Join Date
    Nov 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How to add marathi words to mysql table

    Hi...
    Thanks for reply.Actually i am using java,mysql database with netbeans 6.1.Whenever i try to add through command editor it will add values correctly.But whenever i add it through program it will shows '??' marks instead of values.
    Below i am pasting the code which i had used.

    Java code to insert values.I have used jsp page for that.

    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <%@ page language="java" import="java.sql.*,java.util.Enumeration" import="java.sql.Connection" %>
    <html>
    <head>
    <title>Test</title>
     
    </head>
    <body>
     
    <%
    String url="jdbc:mysql://localhost:3306/MyNewDatabase";
    Connection con = null;
    Statement stmt;
    ResultSet rs = null;
    String query,query1;
    PreparedStatement stmt1;
     
    try{
     
     
    try{
     
    Class.forName("com.mysql.jdbc.Driver");
    }
    catch(Exception e)
    {
    out.println("driver_not_found"+e.getMessage());
    }
     
    con = DriverManager.getConnection (url,"root","mysql123");
     
    int id1=1115;
    String word1="आई";
    String pos1="noun";
     
    stmt1=con.prepareStatement("insert into htb_all_words1 values('"+id1 +"','"+word1+"','"+pos1+"')");
    stmt1.executeUpdate();
     
     
    stmt = con.createStatement();
    query = "select * from htb_all_words1 ";
    ResultSet result = stmt.executeQuery(query);
     
    while(result.next())
    {
    String id= result.getString(1);
     
    String word2=result.getString(2);
     
    String pos2=result.getString(3);
     
    %>
    <br><% out.println(id);%>
     
    <% out.println(word2);%>
    <% out.println(pos2);%>
     
     
    <% 
    }
    }
    catch(Exception e)
    {
    out.println("SQLException_caught:_" + e.getMessage());
    }
     
    finally {
    try {
    if (con != null) con.close();
    }
    catch (SQLException e) {}
     
    } 
     
    %> 
    <br>
    Second JSP page...................
    </body>
    </html>

    THIS IS THE OUTPUT I AM GETTING

     
     
    !-- Document : keyboard Created on : Sep 16, 2008, 10:24:59 PM Author : staff --> 
    1 धन verb 
    2 पुण verb 
    3 पुण verb 
    10 पुण verb 
    11 ?? noun 
    99 शोध noun 
    100 पुण verb 
    111 905 noun 
    112 u0905 noun 
    113 905 noun 
    114 905 noun 
    115 u0905 noun 
    116 \u0905 noun 
    1000 ?? verb 
    1001 पुण noun 
    1002 †œ noun 
    1003 †œ noun 
    1004 धन verb 
    1111 ?? noun 
    1113 ?? noun 
    1114 आई noun 
    [COLOR=red]1115 ?? noun [/COLOR]
    Second JSP page...................

  4. #4
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: How to add marathi words to mysql table

    This sounds like a classical UTF-8 madness issue, you need to make sure your database accepts UTF-8 as well, have you had a look in it to see what the data is actually like?

    After that you need to make sure the JSP page is actually set to use the correct character set so that the website is sent to the browser as UTF-8. You could have a look at content type for this.

    Last thing to do might be to check your servlet container and make sure it is set up to deliver and handle UTF-8.


    // Json

Similar Threads

  1. Replies: 2
    Last Post: July 8th, 2009, 06:35 AM
  2. Getting table height using JSTL
    By jsnx7 in forum JavaServer Pages: JSP & JSTL
    Replies: 1
    Last Post: March 19th, 2009, 12:03 PM
  3. Use of Unicode 5.1 in MySQL DB with Java
    By Desert Fox in forum JDBC & Databases
    Replies: 2
    Last Post: November 12th, 2008, 08:29 AM