Here is the problem. Please read it carefully. I want a solid answer and not guessed answers.
We had installed MySQL 3.22 for years and recently we did a project using that version reading the DB via JAVA/JDBC.
We had written a function like this....
public static String getItem(String columnName, String headerName)
database = GIIDatabaseManager.makeConnection();
Statement statement = database.createStatement();
String statementString = "SELECT " + columnName +
" FROM "+ theTable.trim() +
" WHERE HeaderName = '"+
headerName + "'";
ResultSet theResults = statement.executeQuery(statementString);
System.out.println("Error in Here");
This worked well with MySQL 3.22, because even if the database is closed, the
theResult (ResultSet) object is now populated. so the return result is extracted from
the theResult object in the memory. So it wasn't matter if the database connection was
closed or not.
AFTERWARDS We Installed MySQL 5.0.43 and moved the tables into that database.
Now WE canot use the above function.
Reason we have found out was that because, in the function, we close the database
before the values is read from the resultset ; throwing the following exception.
Obviosly MYSQL 5.0.43 works differently.
We have a soultion. Shown below is the solution we are think to have. But we have many many
functions like this. But we are concerned about the enormous about of code changes in all
functions like this.
Here is the solution, that works well with MySQL 5.0.43
String returnValue = theResults.getString(columnName);
This works in 5.0.43 but the problem is it's an enormous amount of code change in the whole system.
So my question is....
WHY WOULD THE ResultSet Object (in MySQL 5.0.43), after populated, would want the connection to
the DB to read the data?.
Is there a simple solution to this?