Closed. This question is not reproducible or was caused by typos。它当前不接受答案。












想改善这个问题吗?更新问题,以便将其作为on-topic用于堆栈溢出。

5年前关闭。



Improve this question




我试图将数据插入MySQL,但出现错误:


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);
        }
    }

}

java - 编译错误 “cannot find symbol”-LMLPHP

最佳答案

它是c.createStatement()而不是c.CreateStatement()

您需要在方法名称c中将该createStatement()转换为小写

10-05 21:10