ID | RECORDTYPE | RECORDNUMBER | SOURCESYSTEMID | TARGETSYSTEMID |
我有问题提取这些数据并将其存储在数组列表中并插入到数据库中。你能帮我吗?..
这是我的代码: -
public void massageData(String tmp) {
String Id = "";
String RecordType = "";
String RecordNumber = "";
String sourceSystemId = "";
String targetSystemId = "";
String TelNo = "";
String[] recArray = tmp.split("\\|");
RecordType = recArray[1].trim();
RecordNumber = recArray[2].trim();
sourceSystemId = recArray[3].trim();
targetSystemId = recArray[4].trim();
TelNo = recArray[5].trim();
Connection conn = null;
ResultSet rs = null;
PreparedStatement stmt = null;
String actualMSISDN = parseMSISDN(TelNo);
String iCtr = getiCtr(actualMSISDN);
Id = recArray[0].trim();
String stateCode = lookupStateCode(State);
try {
conn = ds.getConnection();
// insert post process data to data_999 table
String sQuery = "insert into DATA_999 (ID,RecordType,RecordNumber,SourceSystemApplicationId,TargetApplicationId,TelNo) values(?,?,?,?,?,?)";
stmt = conn.prepareStatement(sQuery);
int dbStat = stmt.executeUpdate();
int isExist = chkMsisdn(actualMSISDN);
if(isExist > 0) {
// retrieve record from database
icData oldData = getRecord(actualMSISDN);
icData newData = new icData();
stmt.setString(1, Id);
stmt.setString(2, RecordType);
stmt.setString(3, RecordNumber);
stmt.setString(4, sourceSystemId);
stmt.setString(5, targetSystemId);
stmt.setString(6, TelNo);
}
conn.close();
} catch(SQLException s) {
logger.error(s.getMessage());
} finally {
try {
if(stmt != null) stmt.close();
} catch(SQLException e) {
}
try {
if(conn != null) conn.close();
} catch(SQLException e) {
}
}
}
任何人在这段代码中发现任何错误?请帮帮我!!我花了两周时间找出问题所在..来自......> _< .. 非常感谢您的关注,帮助和支持!谢谢.. :)
答案 0 :(得分:1)
在设置参数(stmt.executeUpdate()
)之前,您似乎正在执行语句(stmt.setString()
)。