can anybody assist me to how you can connect my java forms to my mysql database? i've this following codes however it did not work...

private void saveActionPerformed(java.awt.event.ActionEvent evt) {                                        

    String value1 = textField1.getText();
    String value2 = textField2.getText();
    String value3 = textField3.getText();
    String value4 = textField4.getText();
    Connection con = null;
    String url = "jdbc:mysql://localhost:3306/Marketing";
    String driver = "com.mysql.jdbc.Driver";
    String db = "Marketing";
    String user = "root";
    String pass = "";
    System.out.println(value1 + value2 + value3 + value4);
    try {
        con = DriverManager.getConnection(url + db, user, pass);
        PreparedStatement st = con.prepareStatement("insert into clients (idclients,    name, address, contact_person, contact_num) values(?,?,?,?,?)");
        st.setString(2, value2);
        st.setString(3, value3);
        st.setString(4, value4);
        JOptionPane.showMessageDialog(jPanel1, "Data is successfully inserted into database.");
    } catch (Exception e) {
        JOptionPane.showMessageDialog(jPanel1, "Error in submitting data!");

One problem I can tell immediately is your PreparedStatement needs 5 parameters (one to five) yet you are only setting 3! Next, I am unsure the reason why you use DriverManager.getConnection( url +db , ... ) whenever your database URL already consists of a database title, so use just DriverManager.getConnection(url,user,pass). With that said though, it might be good should you could clarify just what does not work?

There's trouble with connection code :

url = jdbc:mysql://localhost:3306/Marketing
db  = Marketing

url + db = jdbc:mysql://localhost:3306/MarketingMarketing 

here you need to remove one extra marketing

The mistake is within this statement:

 con = DriverManager.getConnection(url + db, user, pass);

The getConnection method connect with database on url specified by first parameter. Here you mix 2 variables named url and db so that your connection url will end up: jdbc:mysql://localhost:3306/MarketingMarketing which might be not the one thing you would like. Only use url rather than url + db.