Recently I looked into a technical issue with DB adapter where the update was not working even though it was not throwing any error. Everything seems to be working fine but the field is never updated.
All the settings looked fine but the update was not happening. So we checked the table which revealed that the all the string fields were of char type. It didn’t seem to value much as my understanding was that char will work similar to varchar. I was puzzled to see the Note from Oracle @Oracle DBAdapter documentation ,but it was true.
It reads as :: Oracle recommends that you use
charfor primary key columns, otherwise you must set the
false. The truncation of trailing spaces could cause the primary key to be read incorrectly, making it impossible to update read rows as processed.
Issue :: The Primary Key fields in Database were of char type and data contains trailing spaces. Since by default
property is set to true, weblogic will trim these spaces, there by it will not be able to fetch the correct rows from DB. So update fails as it will not be able to fetch the row properly.
Set the shouldTrimStrings property to false in weblogic DBAdapter Outbound Connection Properties
By default the property shouldTrimStrings is not visible in Outbound Connection Properties, so we will not able to change it.
So to modify the value a new entry needs to added to the DBAdapter config properties. This is one time configuration task that needs to done by updating the ra.xml from filesystem.
1. Take a backup of DBAdapter.rar
2. Extract the entire content.(use unzip tools)
3. Edit the META-INF/ra.xml.
Add a property in ra.xml file
4. Re-Create the DbAdapter rar file.
>>>>jar.exe -cvf DbAdapter.rar -C DbAdapter/ .
adding: DBAdapter.jar(in = 551405) (out= 519781)(deflated 5%)
ignoring entry META-INF/
ignoring entry META-INF/MANIFEST.MF
adding: META-INF/ra.xml(in = 13473) (out= 2866)(deflated 78%)
adding: META-INF/weblogic-ra.xml(in = 6713) (out= 1775)(deflated 73%)
adding: toplink-grid.jar(in = 102529) (out= 91349)(deflated 10%)
5. Update the DBAdapter from Deployments
From Console the property should be available for all the database adapter connection under Outbound Connection Properties.
Thanks to Thani, Lee, Sampath for helping with this issue.