question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

error in PgResultSet#getBlob(int)

See original GitHub issue

It seems org.postgresql.jdbc.PgResultSet#getBlob(int) is wrong in version group: 'org.postgresql', name: 'postgresql', version: '42.1.1' IDE shows me its code as:

  public Blob getBlob(int i) throws SQLException {
    checkResultSet(i);
    if (wasNullFlag) {
      return null;
    }

    return makeBlob(getLong(i));
  }

and I think there should not be makeBlob(getLong(i)); but makeBlob(getColumnOID(i)); cause makeBlob wants oid as only param, and getLong seems to return Long value of that column and not an oid I’m getting an error here:

Exception in thread "main" org.postgresql.util.PSQLException: Bad value for type long : \xabcd
	at org.postgresql.jdbc.PgResultSet.toLong(PgResultSet.java:2860)
	at org.postgresql.jdbc.PgResultSet.getLong(PgResultSet.java:2114)
	at org.postgresql.jdbc.PgResultSet.getBlob(PgResultSet.java:418)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
polobocommented, May 10, 2017
1reaction
polobocommented, May 10, 2017

Searching Google with: “jdbc getblob postgresql” gets you to previous discussions on this question. In short, blob/clob points to PostgreSQL’s “Large Object” system. bytea and text types are accessed via getBytes and getString respectively.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ResultSet.getClob() causing problems when used with JPA's ...
To: pgsql-jdbc(at)postgresql(dot)org. Subject: Re: ResultSet.getClob() causing problems when used with JPA's @Lob. Date: 2016-07-27 19:19:52.
Read more >
ResultSet.getClob() causing problems when used with JPA's ...
Hi. I have a varchar-column in a table which maps to a field (of type String) in a JPA-entity. When marking that String-property...
Read more >
ResultSet.getBlob() Exception - oracle - Stack Overflow
The SQL developer workbench by default converts longtext to CLOB (make sense to me) but the code was expecting Blob. I guess the...
Read more >
SQL error messages and exceptions - Oracle Help Center
ResultSet.relative(int row) cannot be called when the cursor is not positioned on a row. X0X95, Operation ' <operationName> ' ...
Read more >
PostgreSQL 7.3, Blob, and OID - Hibernate Forums
PG 7.3 and the corresponding JDBC driver appears to support ResultSet.getBlob and PreparedStatement.setBlob with OID columns.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found