双11狂欢大促

盲盒赢 定制羽绒服

开启惊喜盲盒,抽取你的专属好礼

— 惊喜奖品抢先看 —

寻求大腿帮助: You have an error in your SQL syntax; check the manual that corresp

水星3号 水星3号 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
控制台报错:
连接数据库。。。
实例化Statement对...
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 '<id,vx,vy,vz,sx,sy,sz,instime.trl>) values ('1.0,0.004184833333333334,-0.0226754' at line 1
at sun.reflect.GeneratedConstructorAccessor8.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
at com.mysql.jdbc.Util.getInstance(Util.java:387)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:942)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2526)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2673)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2545)
at com.mysql.jdbc.StatementImpl.executeUpdateInternal(StatementImpl.java:1540)
at com.mysql.jdbc.StatementImpl.executeLargeUpdate(StatementImpl.java:2595)
at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1468)
at com.tong.pj1.prog1.Insert(prog1.java:290)

代码:
private static void Insert(double[][] fd,int num) {
// TODO Auto-generated method stub
Connection conn = null;
Statement stmt = null;
int i=num;
try{
//注册JDBC驱动
Class.forName("com.mysql.jdbc.Driver");

//打开链接
System.out.println("连接数据库。。。");
conn = DriverManager.getConnection(DB_URL,USER,PASS);
conn.setAutoCommit(false);
//执行查询
System.out.println("实例化Statement对...");
stmt = conn.createStatement();
String sql;

sql = "insert into sensorn1 (<id,vx,vy,vz,sx,sy,sz,instime.trl>) values ('"+fd[i][0]+"," //插入id
+fd[i][1]+"," //插入vx
+fd[i][2]+"," //插入vy
+fd[i][3]+"," //插入vz
+fd[i][4]+"," //插入sx
+fd[i][5]+"," //插入sy
+fd[i][6]+"," //插入sz
+fd[i][7]+"," //插入instime
+fd[i][8]+"')"; //插入trl

stmt.executeUpdate(sql);

conn.commit();



}catch(SQLException se){
se.printStackTrace();
}catch(Exception e){
e.printStackTrace();
}finally{
try{
if(stmt!=null) stmt.close();
}catch(SQLException se2){

}
try{
if(conn!=null) conn.close();
}catch(SQLException se){
se.printStackTrace();
}
}


}
...全文

相关推荐

数据库疑难杂症 java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual tha

数据库疑难杂症 java.sql.SQLSyntaxErrorException: 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 ‘order’ at line 1 数据库报错如下: Error querying database. Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL

weixin_38717896

mysql报错:MySQL server version for the right syntax to use near type=InnoDB的解决方法

本文实例讲述了mysql报错:MySQL server version for the right syntax to use near type=InnoDB的解决方法。分享给大家供大家参考,具体如下: 一、问题: 工作中使用sql语句建表时,mysql报了如下错误: 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 ‘type=InnoDB’ at line 1 二、解决方案

weixin_38738189

navicat不能创建函数解决方法分享

第一次写MySQL FUNCTION,一直报错, Err] 1064 – 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 ‘`company_id` int) RETURNS varchar(20) CHARSET utf8 BEGIN 本来的函数: CREATE DEFINER=`33323`@`%` FUNCTION `createSaleCode`(`bengin

weixin_38702047

your MySQL server version for the right syntax to use near ‘(0) NOT NULL, `endTime` datetime(0) NO

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 ‘(0) NOT NULL, endTime datetime(0) NOT NULL,avaliableTime int(8) NOT N’ at line 5 今天帮一个朋友调试时,发现MySQL5.5版本的数据库导入执行MySQL5.7版本导出的脚本,报了上面的错误,说说解决办法,其实主要是datetime(0)字段类型的

weixin_38514501

PHP开发中的错误收集,不定期更新。

PHP开发中的错误收集,不定期更新。 php开发的朋友需要用得到。

weixin_38638688
评论 7
收藏 已收藏
分享
返回顶部
水星3号
Eclipse 58,439 成员 49,457 内容