FUNCTION database.curren_date does not exist是怎么回事?

来源:2-4 JDBC实战---搭建模型层 Ⅱ

qq_哭的狠丶低调_0

2017-09-15 02:14

Connection con = DBUtil.getConnection();

String sql = "insert imooc_goddess( user_name,sex,age,birthday,email,mobile,"

+ "create_user,create_date,update_user,update_date,isdel)"

+ "values(?,?,?,?,?,?,?,curren_date(),?,curren_date(),? )";

PreparedStatement prepareStatement =  con.prepareStatement(sql);

prepareStatement.setString(1, gs.getUser_name());

prepareStatement.setInt(2, gs.getSex());

prepareStatement.setInt(3,gs.getAge());

prepareStatement.setDate(4,new Date( gs.getBirthday().getTime()));

prepareStatement.setString(5, gs.getEmail());

prepareStatement.setString(6, gs.getMobile());

prepareStatement.setString(7, gs.getCreate_user());

prepareStatement.setString(8, gs.getUedate_user());

prepareStatement.setInt(9, gs.getIsdel());

prepareStatement.execute();








Goddess g = new Goddess();

g.setUser_name("宝宝");

g.setAge(22);

g.setSex(1);

g.setBirthday(new Date());

g.setEmail("25544544");

g.setMobile("15555555");

g.setCreate_user("wangwu");

g.setUedate_user("lisi");

g.setIsdel(1);

GoddessDao god = new GoddessDao();

god.addGoddess(g);

报错:

Exception in thread "main" com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: FUNCTION xiaokang.curren_date does not exist

写回答 关注

1回答

  • 慕粉3119548
    2017-09-16 23:23:28
    已采纳

    是不是current_date啊?

JDBC之 “ 对岸的女孩看过来”

一起领略JDBC的奥秘,为进一步学习集成框架打下良好的基础

99327 学习 · 856 问题

查看课程

相似问题