How to insert Unicode values to MySQL using Java-Part 3

This is the last part of our Unicode based project and in this project we will see how to retrieve our inserted values from MySQL table to our GUI.

You can see  i have a button and  one combo box retrieve data and display it.Once i click my button it will go to database and get values to array list and fill my combo box. See the below code i did that.

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed

        ArrayList names = new ArrayList();

        try
        {
            conn=getcon.creatConnection();//getting connection

            //execute query

             ResultSet rs = conn.createStatement().executeQuery("select name from unicode");

             while (rs.next())
             {

                 String Cusname = rs.getString("name");
                 names.add(Cusname);

            }

             rs.close();
             DefaultComboBoxModel model = new DefaultComboBoxModel(names.toArray());
             cmboUnicode.setModel(model);

        }
        catch(Exception ex)
        {
            JOptionPane.showMessageDialog(rootPane, ex);
        }

    }

same as my previous post i have to create the object top of my class like this.

connection getcon = new connection();
Connection conn;

This method will called once i click the find button.These things normal than any other program.But you must concert clearly about my connection class. Here important things of the program are

Connection class , Use general Unicode font, Use java latest version, Handle exception while you are testing or develop it

Below you can download my complete project and if you have any problem comment on me.Thank you and best of luck

Download this video

Download Project

8 thoughts on “How to insert Unicode values to MySQL using Java-Part 3

  1. bro your download link not working and i want to know how to set utf-8 in mysql exactly. i didn’t get it from your lesson.

  2. hello,
    I am doing a project in which a user will input a Hindi text to identify the presence of any idiom this will be done through pattern matching. My query is how can i use Hindi using java will it follow the same steps that u have done in your project ..or will it be different.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s