Question
· Apr 27, 2018

PostgreSQL query returns error

LS,

I'm executing a query using JDBC on a PostgreSQL db:

SET statement_timeout TO 600000000; COMMIT SELECT * FROM bi_hour

The query is aborted with the following message:

FOUT #5023: Fout in Java Gateway: JDBC Gateway getClob(0,2) errorBad value for type long : active

The column 'blocked_status' contains the value 'active' is of type 'text'. I figure somewhere the SQL Gateway tries to convert the text value into a long but I can't find where, any suggestions?

Discussion (4)1
Log in or sign up to continue

Hello Dmitry,

Thanks for the reply, it seems to be all the columns of type "text". I've tried casting them to varchar but keep getting the same error.

I think it's something in the JDBC Gateway, perhaps in the setup I've got the gateway is very slow if I compare it with an open source client (Squirrel) the query there runs for only 15 seconds, if I execute the same query through the JDBC gateway it takes more then 15 minutes.

Was this issue ever resolved?  I'm experiencing the same thing when trying to read an Amazon Redshift column set up as varchar(65535) from an Enslib.SQL.OperationGenericOperation in a production.  I can read any of the other columns in the table, but when I try to read the varchar(65535) column, I get the following error:

An error was received : ERROR #5023: Remote Gateway Error: JDBC Gateway getClob(0,1) errorRemote JDBC error: Cannot convert the column of type VARCHAR to requested type long..

I know Redshift is similar to postgresql and doesn't support CLOBs, but hoping there is a workaround.  As Joost stated, casting the column to a different data type doesn't seem to work.

Hi @Joost Platenburg and @Don Martin 
 

I had the same problem this week. 

With the help of some friends, I was able to find the solution. Try converting your field "text" like this: field_type_text::varchar(400)

Your query would then look like this:

select blocked_status::varchar(400) from table

I know your problem is from 2018, but since I didn't find an answer to the problem in the post, I decided to post the solution that worked for me here.