Migration to Mysql Connector Jar 5.1.27

情到浓时终转凉″ 提交于 2019-12-13 01:25:27

问题


I have just replaced my mysql connector jar 3.1.12 to 5.1.27. and getting error

You need to specify Statement.RETURN_GENERATED_KEYS to the Statement.executeUpdate() or Connection.prepareStatement().

I got the solution that i should use

PreparedStatement ps = connection.prepareStatement(SQL, Statement.RETURN_GENERATED_KEYS);

instead

PreparedStatement ps = connection.prepareStatement(SQL); 

The main problem is how can I replace this in whole project and is there any method to set it globally?

Is there any other Issues with 5.1.27 version which I should keep in mind?


回答1:


This defect is already raised to MYSQL team and they have fixed this issue in version 5.1.8. But this issue still exists for latest versions. So far this has not fixed. Please refer the below link for more info -

http://bugs.mysql.com/bug.php?id=41448

Connector J 5.1.8 - Working Connector J 5.1.10 - Not Working Connector J 5.1.18 - Not Working Connector J 5.1.21 - Not Working



来源:https://stackoverflow.com/questions/20122075/migration-to-mysql-connector-jar-5-1-27

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!