• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Oracle BLOB over the Java bridge
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Oracle BLOB over the Java bridge


  • Subject: Re: Oracle BLOB over the Java bridge
  • From: Jeff LaMarche <email@hidden>
  • Date: Sat, 15 Jun 2002 21:24:12 -0700

On Saturday, June 15, 2002, at 12:44 AM, Ivan Myrvold wrote:

> If I have NSData on the Object-C side, which I want to send over the Java
> bridge to write it to an Oracle BLOB field, what is the receiving type on
> the Java side?

Are you using JDBC drivers? Typically, when you're dealing with BLOB data,
you're dealing with byte arrays or byte streams, but you can also use strings
if you're careful to specify the encoding so Java doesn't do any conversion
on the data - like this:

myBlobData = new String(data, "8859_1");

I'm not that familiar with the Java Bridge, but I would assume that you would
want to get a regular old C pointer to the data held by your NSData object
and pass that information over using whatever mechanism exists. I think you
may need to use a prepared statement if you're dealing with Blobs (that's
true for most JDBC drivers, but not all), so you would use the setBytes method
of PreparedStatement and pass in your byte[] data, something like:

pstmt.setBytes(6,data);

of, you could use the setString method:

pstmt.setString(6, myBlobData);


Although I'd use the setBytes version because it's possible that the database
will try to convert the string to some internal format in the latter case,
if you're running a Unicode database or another form of double-byte characterset.

Hope this helps..

- Jeff
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Oracle BLOB over the Java bridge (From: Ivan Myrvold <email@hidden>)

  • Prev by Date: Re: Custom Open/Save Directory Tree
  • Next by Date: Re: Newbie-Initialization Question
  • Previous by thread: Oracle BLOB over the Java bridge
  • Next by thread: Issues with [ NSInvocation isEqual: ]
  • Index(es):
    • Date
    • Thread