title: Access mysql database in eclipse using java
body: <p>I created a simple mysql database table using following query:</p>
  
  <pre><code>CREATE TABLE customer(
  name varchar(20),
  C_ID int NOT NULL AUTO_INCREMENT,
  address  varchar(20),
  email varchar(20),
  PRIMARY KEY(C_ID)
  );
  </code></pre>
  
  <p>Now I want to insert values to this table. My client like this:</p>
  
  <pre><code>package com.orderdata.ws;
  
  import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.ResultSet;
  import java.sql.PreparedStatement;
  
  import com.mysql.jdbc.Statement;
  
  public class OrderData {
  public static void main(String[] args)throws Exception{
      Class.forName("com.mysql.jdbc.Driver");
      Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/orderdata","root","chathura");
      Statement stmt = (Statement) con.createStatement();
      String insert = "INSERT INTO customer(name,C_ID,address,email)      VALUES (a,5,b,c)";
      stmt.executeUpdate(insert);
  
  }
  
  }
  </code></pre>
  
  <p>But this gives an exception "Exception in thread "main" com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(a,5,b,c)' at line 1............"</p>
  
  <p>How can I insert data using eclipse???</p>