ID | RECORDTYPE | RECORDNUMBER | SOURCESYSTEMID | TARGETSYSTEMID |
I have problem to extract this data and store it in array list and insert into database. Could you please help me?..
This is my code:-
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) {
}
}
}
anyone find any mistakes inside this code?..please help me!!..I spend two week to find out what is the problem..arrgghhh..>_<.. your attention, help and support are much appreciated!..thank you..:)
在设置参数( stmt.setString()
)之前,您似乎正在执行语句( stmt.executeUpdate()
stmt.setString()
)。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.