0 Replies Latest reply: Aug 17, 2007 5:55 AM by 807600 RSS

    Displaying Japanese in Browser from MySQL query

    807600
      Hi All,

      I have the following jsp where I am trying to query a MySQL database for japanese words and display them on a web page.
      <html>
      <head>
      <%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
      <%@page import="java.sql.*" %>
      </head>
      
      <%
      String connectionURL = "jdbc:mysql://localhost:3306/japanese?user=;password=";
      Connection connection = null;
      Statement statement = null;
      ResultSet rs = null;
      %>
      
      
      <body>
      
      <%
      Class.forName("com.mysql.jdbc.Driver").newInstance();
      connection = DriverManager.getConnection(connectionURL, "root", "");
      statement = connection.createStatement();
      rs = statement.executeQuery("SELECT kanji, kana, english FROM vocab");
      
      while (rs.next()) {
      out.println("Kanji: " + rs.getString("kanji")+"<br>");
      out.println("Kana: " + rs.getString("kana")+"<br>");
      out.println("English: " + rs.getString("english")+"<br>");
      }
      
      rs.close();
      %>
      
      </body>
      </html>
      But when I run this through my browser (http://localhost:8180/japanese/mysql.jsp) I get the following output:
      Kanji: ???
      Kana: ??????
      English: elephant

      I am using:
      * mysqld Ver 5.0.22-Debian_0ubuntu6.06.3-log for pc-linux-gnu on i486 (Debian Etch distribution)
      * Apache/Tomcat 5.0
      * java-6-sun

      Can someone please tell me what I need to do?