I have an alpha
table on a Oracle 11g DB with id INTEGER
, data VARCHAR2(5)
, and last_update TIMESTAMP
columns in it.
I query the table using its primary key column (id
column) from a Java 8 application hosted on WebLogic 12 server. The query is implemented in Spring Framework 4.2's NamedParameterJdbcDaoSupport
class and I fetch the results by iterating the returned java.sql.ResultSet
object.
So far so good. I get either 0 or 1 record based on the absence or presence of the id
value supplied in the query. And data
and last_update
columns are retrieved as is from the database table.
I had to increase the size of data
column to 6 bytes for a new requirement using ALTER TABLE alpha MODIFY data VARCHAR2(6);
statement. And I updated all the rows with 6 character values for data
column and the current time for last_update
column. When I query the table from any SQL client, I see the 6 character values for data
column and the correct last_update
value that I updated.
But the Java 8 application still retrieves the 5 character value for data
column. The last_update
values retrieved are the correct values that I updated. There are no length trimming codes in the application and the getters and setters are in a plain POJO.
I could see a similar issue in Coderanch, but even there I don't see the cause being listed, and a proper fix. Any assistance is appreciated.
The issue was resolved after restarting the WebLogic instances.
Looks like the PreparedStatement
used by the query cached column length and was relying on that value to retrieve data
value.