In prepared statement after SQLException on SQL Width in JAVA - progress-4gl

I have a problem with prepared statements in JDBC against an OpenEdge database, when we get the following exception:
java.sql.SQLException: [DataDirect][OpenEdge JDBC Driver][OpenEdge] Column Namn in table PUB.Brevlada has value exceeding its max length or precision.
I'm well aware of the fix for this with DBTool but I have another question. When we have used the prepared statement and got this Exception it can't be used again to fetch other entries in the table that hasn't got the width problem. We then get a slightly different exception:
java.sql.SQLException: [DataDirect][OpenEdge JDBC Driver][OpenEdge] Column %s in table %s has value exceeding its max length or precision (7864)
Is this a problem with the SQL Statement Cache on the server, and is there any workaround for this except for re-initialization of the JDBC connection to the database?

Related

Convert DB2 into Postgresql

I am getting error when try to run the query with Postgres
ALTER TABLE EMP.USER DETACH PARTITION ID_CUST_111111 INTO DATA_PRTTN.ID_CUST_111111_USER
Wrapped by: java.sql.SQLException: SQL: ERROR: syntax error at or near "INTO"
You don't place a partition in a table in PostgreSQL. A partition already is a table. So simply remove the INTO table_name from the statement. You can rename the partition after detaching, but I don't see much sense in that.

Unable to use SQL View in DataStage ODBC Connector

Trying to use the SQL data in DataStage using ODBC Connector . Tried below options but was not succeeded
Used CTE query as my data has duplicate records but got the following error(Number of bound columns exceeds the number of result columns) as am using Row Number. This works fine in the SQL server
2.To resolve this , created a view in the SQL and tried using the same view in DataStage ODBC Connector but getting invalid object name error
Is there any better approach I can follow to get the data from SQL and used it in DataStage.

Is there a way to get the row and column where the INSERT-Statement failed in PostgreSQL?

I'm trying to insert around 15000 rows with 200 columns in one batch into a table in PostgreSQL (with TimescaleDB extension) via Python by using the psycopg2 library. Some of the values I want to insert might be larger than the table's column datatype allows. This results in:
ERROR: smallint out of range, SQL state: 22003
I haven't found a way to get more information about the location of the error to handle it.
In MySQL, the column and the row where the error occured is reported back by default and it is even possible to clip the values to the max value of its datatype (which also would be fine). Is there a way to handle this in a similar manner in PostgreSQL?

DB2 SQL Error: SQLCODE=-433, SQLSTATE=22001 when inserting Base64 CLOB data

DB2 exception - DB2 SQL Error: SQLCODE=-433, SQLSTATE=22001 is thrown when inserting a Base64 CLOB data with length of 38K characters into DB2 table CLOB field defined with length of 10MB. Database insertion is done via a Stored Procedure called by a MuleSoft flow. We've been unable to find the root cause or solution to this. Has anyone seen this behaviour?

Can I configure flyway to ignore the installed-by column in the metadata table?

We're using flyway with cloudfoundry. In short, we have no control over username/password for the database (by design), and it's a very long string that's greater than 30 characters. When I try to run the migration, I get the following error:
flyway.core.api.FlywayException: Unable to insert metadata table row for version 0
... stacktrace ...
Caused by: org.postgresql.util.PSQLException: ERROR: value too long for type character varying(30)
... more stacktrace ...
Can I configure flyway to ignore the installed-by column in the metadata table? I suspect this could be fixed by building flyway with a larger column, or to concat the username.
EDIT
I was able to mitigate the issue by logging into the database and expanding the column to 50 characters manually:
alter table schema_version alter column installed_by set data type character varying(50);
It's still a manual step in a setup that's supposed to be hands-off, so this might still be a feature request in flyway (support larger usernames).
As per Axel's comment, I filed the enhancement request here.