-2

I am trying to insert data into MySQL and I'm getting an error:

cannot find symbol c

import java.sql.*;

class Insert{

    public static void main(String args[]){
        try{
            Class.forName("com.jdbc.mysql.Driver");
            Connection c = DriverManager.getConnection("jdbc:mysql://localhost:3036/db","ravi","ravi");
            //showing error in the below statement at c
            Statement stmt = c.CreateStatement();
            int result=stmt.executeUpdate("Insert into emp values(3,'david',33) ");
            System.out.println("success");
            c.close();
        } catch(Exception e) {
            System.out.println(e);
        }
    }

}

enter image description here

BalusC
  • 992,635
  • 352
  • 3,478
  • 3,452

1 Answers1

-1

It's c.createStatement() and not c.CreateStatement().

You need to make that c to lowercase in the method name createStatement()

Aditya Singh
  • 2,275
  • 1
  • 17
  • 38