이상한 문제가 있습니다. MySQL 5.1 데이터베이스에 SELECT 쿼리를 실행하고 UPDATE 쿼리를 커밋하고 다시 SELECT 쿼리를 수행 할 수 없습니다 열 찾기).
가 // UPDATE커밋 된 업데이트 (JDBC, MySQL) 후 열을 찾을 수 없습니다.
PreparedStatement commonUpdate=null;
try {
String queryUpdate="UPDATE computers SET name=?, serial=?, inv_number=?, comments=?, rack_unit=?, box_unit=?, ram=? WHERE ID="
+currentComp.getComputers_id();
dbhIrmdb.setAutoCommit(false);
commonUpdate=dbhIrmdb.prepareStatement(queryUpdate);
commonUpdate.setString(1, currentComp.getComputers_name());
...
commonUpdate.executeUpdate();
dbhIrmdb.commit();
} catch (SQLException ex) {
ex.printStackTrace();
try {
System.err.print("Transaction is being rolled back");
dbhIrmdb.rollback();
} catch(SQLException excep) {
excep.printStackTrace();
}
}
finally {
if (commonUpdate != null) {
commonUpdate.close();
}
dbhIrmdb.setAutoCommit(true);
}
내가 사이트를 통해 깊은 연구를
dbhIrmdb.setAutoCommit(false);
PreparedStatement preparedSelect=null;
preparedSelect=dbhIrmdb.prepareStatement(query);
ResultSet rowSet=preparedSelect.executeQuery();
dbhIrmdb.commit();
while (rowSet.next()) {
computer=new ComputerInfo();
computer.setIndex(index); index++;
computer.setComputers_id(rowSet.getString("computers_id"));
....
}
dbhIrmdb.setAutoCommit(true);
SELECT // 그러나 나는 이러한 경우를 찾을 수 없습니다 :
여기 내 코드입니다.
도움이나 조언을 주시면 감사하겠습니다.
이 시도하고 ID는 = "+ currentComp.getComputers_id()'. 어서 WHERE 당신은'이 ... –
대문자/소문자가 있습니까? – jaczes
업데이트에는'ID'가 있고 질의에는'computers_id'가 있습니다. 어떤 버전인지 결정해야한다고 생각합니다. 업데이트가 성공하면 'ID'가 올바른 것으로 의심됩니다. one. –