這篇文章主要講解了“Sqoop在導(dǎo)入MySQL數(shù)據(jù)時(shí)遇到Timestamp列為空時(shí)報(bào)錯(cuò)怎么辦”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來(lái)研究和學(xué)習(xí)“Sqoop在導(dǎo)入MySQL數(shù)據(jù)時(shí)遇到Timestamp列為空時(shí)報(bào)錯(cuò)怎么辦”吧!
我們提供的服務(wù)有:成都做網(wǎng)站、網(wǎng)站設(shè)計(jì)、微信公眾號(hào)開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、富裕ssl等。為超過(guò)千家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的富裕網(wǎng)站制作公司
Error: java.io.IOException: SQLException in nextKeyValue at org.apache.sqoop.mapreduce.db.DBRecordReader.nextKeyValue(DBRecordReader.java:277) at org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.nextKeyValue(MapTask.java:556) at org.apache.hadoop.mapreduce.task.MapContextImpl.nextKeyValue(MapContextImpl.java:80) at org.apache.hadoop.mapreduce.lib.map.WrappedMapper$Context.nextKeyValue(WrappedMapper.java:91) at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145) at org.apache.sqoop.mapreduce.AutoProgressMapper.run(AutoProgressMapper.java:64) at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:787) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341) at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:168) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:422) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657) at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:162) Caused by: java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Date at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927) at com.mysql.jdbc.ResultSetRow.getDateFast(ResultSetRow.java:141) at com.mysql.jdbc.ByteArrayRow.getDateFast(ByteArrayRow.java:238) at com.mysql.jdbc.ResultSetImpl.getDate(ResultSetImpl.java:2185) at com.mysql.jdbc.ResultSetImpl.getDate(ResultSetImpl.java:2147) at org.apache.sqoop.lib.JdbcWritableBridge.readDate(JdbcWritableBridge.java:115) at com.cloudera.sqoop.lib.JdbcWritableBridge.readDate(JdbcWritableBridge.java:87) at party_org.readFields(party_org.java:441) at org.apache.sqoop.mapreduce.db.DBRecordReader.nextKeyValue(DBRecordReader.java:244) ... 12 more
Sqoop在導(dǎo)入MySQL數(shù)據(jù)時(shí)遇到Timestamp列為空時(shí)報(bào)錯(cuò),解決方法是:在JDBC連接后加上?zeroDateTimeBehavior=convertToNull
例如:
sqoop import --driver com.mysql.jdbc.Driver --connect jdbc:mysql://192.168.4.48:3306/xdgc?zeroDateTimeBehavior=convertToNull --username root --password <...> --table party_org --hive-import --hive-table ori.party_org --incremental lastmodified --check-column last_update_time --last-value '2014-01-01 00:00:00.000'
感謝各位的閱讀,以上就是“Sqoop在導(dǎo)入MySQL數(shù)據(jù)時(shí)遇到Timestamp列為空時(shí)報(bào)錯(cuò)怎么辦”的內(nèi)容了,經(jīng)過(guò)本文的學(xué)習(xí)后,相信大家對(duì)Sqoop在導(dǎo)入MySQL數(shù)據(jù)時(shí)遇到Timestamp列為空時(shí)報(bào)錯(cuò)怎么辦這一問題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!