jdbc返回有效查询的mySQL语法错误异常

时间:2021-10-31 15:42:14

I user the java.sql.Statement.excecuteUpdate method to create a table and insert some values into the database through JDBC. However, it gives me MySQL syntax exceptions for no reason. I copied and pasted the same code into command prompt. it worked.

我使用java.sql.Statement.excecuteUpdate方法创建一个表,并通过JDBC将一些值插入到数据库中。但是,它无缘无故地给了我MySQL语法异常。我将相同的代码复制并粘贴到命令提示符中。有效。

I'm wondering why it's doing that??

我想知道它为什么这样做?

1 个解决方案

#1


Guessing

You cannot do a query like: insert ...; insert ... ; only one query per method call

您无法执行以下查询:insert ...;插入 ... ;每个方法调用只有一个查询

#1


Guessing

You cannot do a query like: insert ...; insert ... ; only one query per method call

您无法执行以下查询:insert ...;插入 ... ;每个方法调用只有一个查询