Joined June 2015
·

Selvam Ptl

Tiruchchirappalli Area, India
·

try {
Statement stmt;
ResultSet rs;
Class.forName("com.mysql.jdbc.Driver");
String url = "jdbc:mysql://localhost:3306/arabic?useUnicode=yes&characterEncoding=UTF-8";
Connection con = (Connection) DriverManager.getConnection(url, "root", "root");

   // con.setCharacterEncoding("utf-8");
    stmt = (Statement) con.createStatement();
    stmt.executeQuery("SET NAMES 'UTF8'");
    stmt.executeQuery("SET CHARACTER SET 'UTF8'");
    String greekname = "κωνσταντίνα";
    stmt.executeUpdate("INSERT INTO categories(category_id,category_name) VALUES ('" + 17 + "','" + greekname + "')");
    con.close();
} catch (Exception e) {
    System.out.println("problem during the connection with the database!"+e);
}
Achievements
1 Karma
0 Total ProTip Views