Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

presto jdbc execute long sql got error "Request Header Fields Too Large" #184

Open
mirafranc opened this issue Feb 5, 2021 · 1 comment · May be fixed by #185
Open

presto jdbc execute long sql got error "Request Header Fields Too Large" #184

mirafranc opened this issue Feb 5, 2021 · 1 comment · May be fixed by #185

Comments

@mirafranc
Copy link

Getting "Request Header Fields Too Large" when query exceeds 11000 characters.
driver: presto-jdbc-338-e.3.jar - io.prestosql.jdbc.PrestoDriver

Caused by: java.lang.RuntimeException:
returned an invalid response: JsonResponse{statusCode=400, statusMessage=Bad Request, headers=
{connection=[close], content-length=[198], content-type=[text/html], date=[Mon, 01 Feb 2021 20:15:52 GMT], server=[awselb/2.0]}
, hasValue=false} [Error:

<title>400 Request Header Or Cookie Too Large</title>

Similar exception reported here: prestodb/presto#13097
We tried recommended solution by adding 'http-server.max-request-header-size=5MB' in config.properties with no effect.

mirafranc added a commit to mirafranc/jaydebeapi that referenced this issue Feb 5, 2021
@mirafranc mirafranc linked a pull request Feb 5, 2021 that will close this issue
@mirafranc
Copy link
Author

After deeper investigation of DBeaver (works without issue), Spark and JayDeBeApi there are two ways how to execute SQL statement by JDBC:

  1. As prepared statement (used by Spark and JayDeBeApi ):
    statement = connection.prepareStatement(sql)
    statement.executeQuery()
  2. As statement (used by DBeaver):
    connection.createStatement()
    statement.executeQuery(sql)

switching to create statement works correctly for Presto (Trino).
tested locally using DBs based on drivers:
presto-jdbc-338.jar
ojdbc6-11.2.0.4.jar
ojdbc7-12.1.0.2.jar
ojdbc14-8.1.7.1.jar
ojdbc14-10.2.0.5.jar
pijdbcdriver-2019.0.0.jar
ngdbc-2.4.59.jar
sqljdbc4-2.0.jar
terajdbc.16.20.00.12.jar

Issue is caused by wrong driver implementation of prepareStatement in Presto (Trino), anyway DBeaver query approach would be alternative way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant