I have a query which works fine in local database. I just moved into a remote database and the error occurred as follow:
DAO:
public String changeLecture(String CoursesID, String strDate, String strTime, String endTime, String venue, NewCourseInfoBean courseInfo) {
//preparing some objects for connection
Connection currentCon = null;
ResultSet rs = null;
PreparedStatement pstmt = null;
String result = "";
try
{
//connect to DB
currentCon = ConnectionManager.getConnection();
pstmt = currentCon.prepareStatement("select * from course_info where course_code=? and c_date=? and start_time=? and end_time=? and venue=?", ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
pstmt.setString(1, CoursesID);
pstmt.setString(2, strDate);
pstmt.setString(3, strTime);
pstmt.setString(4, endTime);
pstmt.setString(5, venue);
pstmt.executeQuery();
rs = pstmt.getResultSet();
//check whether the class is existed
if (rs.next())
{
rs.updateObject("c_date", courseInfo.getChangeC_date());
rs.updateObject("start_time", courseInfo.getChangeStart_time());
rs.updateObject("end_time", courseInfo.getChangeEnd_time());
rs.updateObject("venue", courseInfo.getChangeVenue());
rs.updateRow();
result = "Lecture slot updated successfully!";
}else{
result = "You do not have lecture with the details provided in 'current lecture slot' fields. Please check your schedule.";
}
}
//catch
//some exception handling
return result;
}
error message:
[MySQL][ODBC 5.3(a) Driver]
[mysqld-5.5.43-0ubuntu0.14.04.1]
Table 'sql679933.COURSE_INFO' doesn't exist
Whenever I provide a right dataset, the data in table course_info
will be updated. However, the programs stops at line pstmt.executeQuery();
if wrong dataset is provided.
Eg.
correct data: select * from course_info where course_code='SSK3100'.....
(works fine)
incorrect data: select * from course_info where course_code='SSK333'......
(cannot execute query)
This query works fine in local db, so what's goes wrong here? :( Please help.