0

I'm trying to read one of columns from one of table from my locally installed PostgreSQL 10.3

Connection conn = DriverManager.getConnection("jdbc:postgresql://localhost:5432/vk", "postgres", "qwerty");
Statement statement = conn.createStatement();
statement.setFetchSize(10);
ResultSet rs = statement.executeQuery("select POST_CONTENT from VK_GROUP_POST");
System.out.println("rs is ready " + rs);

I run program with -verbose:gc -Xmx512M VM options. Project has only dependency: org.postgresql:postgresql:42.2.1

And I always get OOM error:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
...
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2134)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:306)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:307)
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:293)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:270)
at org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:224)
at my.SaveRepostedToFile.main(SaveRepostedToFile.java:10)

Are there any way to avoid OOM?

Cœur
  • 37,241
  • 25
  • 195
  • 267
turbanoff
  • 2,439
  • 6
  • 42
  • 99

0 Answers0