Solve max length or precision with Progress using

2019-09-20 15:46发布

问题:

I'm using spring batch, and I need to query data from a legacy system, which uses the progress database.

However I am with this exception java.sql.SQLException: [DataDirect][OpenEdge JDBC Driver][OpenEdge] Column Ag-Obs-conf in table PUB.Agenda has value exceeding its max length or precision.

I was able to partially solve this problem using a SUBSTR in the select, but I need all the data from the database.

And I can not in any way change the database.

Can anyone give me an idea how to solve this?

Thank you

回答1:

The OpenEdge database stores all data as variable length. Applications very commonly "overstuff" fields beyond the declared "SQL Width" attribute which is what is causing the error that you see.

Prior to OpenEdge 11.6 using dbtool is the standard way to adjust SQL width. It is fast, safe and effective:

http://knowledgebase.progress.com/articles/Article/P24496

Starting from OpenEdge version 11.6 a new database startup parameter was introduced:

-SQLWidthUpdate ON

that can automatically fix the SQL width of character datatypes.

More information about this new feature can be found here:

https://community.progress.com/community_groups/openedge_rdbms/f/18/t/19534

There are also some options in 11.6+ to automatically truncate returned data if that is what you prefer:

http://knowledgebase.progress.com/articles/Article/How-to-enable-Authorized-Data-Truncation-in-a-JDBC-or-ODBC-connection/p