• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ResultSet.getBytes Question

 
Bartender
Posts: 1971
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 1971
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic