Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

ResultSet.getBytes Question

 
Bartender
Posts: 1757
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my code, if I have two statements like the ones below (as an experiment, naturally), the second variable, imageBytes2 has all zeros. The first variable, imageBytes, has the expected data.

However, based on this experiment it looks like the first getBytes is actually removing the data from the ResultSet.


Does this make sense?

In other places, for say an integer PK, I can repeatedly refer to the ResultSet value (of course, creating a simple variable the first time, is the best idea).

Now that I debugged it to find this behavior, it's simple to reproduce. (The solution, of course, is just to use a variable equal to "imageBytes" in the first line, but this is confusing since I can repeatedly refer to a ResultSet field with other data types....???).

Thanks,

-mike
 
Marshal
Posts: 25823
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My guess? It's a "feature" of the JDBC driver. There are some drivers which don't let you read the same column of any type twice, or require you to read them in order.

But it might also be a bug -- do the API docs mention that the method can do that?
 
Mike London
Bartender
Posts: 1757
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Paul Clapham wrote:My guess? It's a "feature" of the JDBC driver. There are some drivers which don't let you read the same column of any type twice, or require you to read them in order.

But it might also be a bug -- do the API docs mention that the method can do that?



This was the current JDBC driver for FileMaker Pro. There is scant documentation other than a few sample calls in a small PDF Reference.

I'm guessing it must be (since I can re-read some columns)... a bug. Plus, I can even re-read the getBytes() column for small image sizes. I didn't do extensive testing, but it seemed that trying to do a second getBytes() on an image column (or other blob type data, a "Container" in FMP) over, say 200KB, would zero out the bytes read.

I'll just chalk it up to a few hours invested in the debugger!

Thanks very much for your reply. :)

-mike
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic