且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

jdbc到MYSQL错误:“表Airportdetails不存在"

更新时间:2022-06-22 02:41:51

executeUpdate()

在此PreparedStatement对象中执行SQL语句,该对象必须是SQL INSERTUPDATEDELETE语句;或不返回任何内容的SQL语句,例如DDL语句.

executeUpdate()

Executes the SQL statement in this PreparedStatement object, which must be an SQL INSERT, UPDATE or DELETE statement; or an SQL statement that returns nothing, such as a DDL statement.

当前,您正在尝试使用它来创建表.这就是为什么您会收到该错误的原因.

Currently you are trying to use this for creating a table. That's the reason why you are getting that error.

请参阅文档 Java 1.4.2 用于 executeUpdate

您应该使用Statement

Statement st = con.createStatement();
String table = "Create table .......";
st.executeUpdate(table);