

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the difference between the methods setBlob() and setBinaryStream() which is preferable in JDBC?
The setBlob() method is used to set value for Blob datatype in the database. It has three variants as follows:
void setBlob(int parameterIndex, Blob x): Sets the given Blob value to the parameter at the specified index.
void setBlob(int parameterIndex, InputStream inputStream): Sets the contents of the given input stream as a value to the parameter at the specified index.
void setBlob(int parameterIndex, InputStream inputStream, long length): Sets the contents of the given input stream as a value to the parameter at the specified index.
The setBinaryStream() method is used to set the contents of the given InputStream as a value for the parameter in the specified index. It has three variants as follows:
void setBinaryStream(int parameterIndex, InputStream x): Sets the contents the given input stream as a value to the parameter at the specified index.
void setBinaryStream(int parameterIndex, InputStream x, int length): ): Sets the contents the given input stream (which will have the specified number of bytes) as a value to the parameter at the specified index.
void setBinaryStream(int parameterIndex, InputStream x, long length): Sets the contents the given input stream (which will have the specified number of bytes) as a value to the parameter at the specified index.
The main difference between the two of these methods is that the setBlob() methods indicates the driver that the parameter value should be sent as a BLOB datatype to the server.
Where as in case of setBinaryStream() method first of all the driver determines in which format the value should be sent, (LONGVARBINARY or BLOB) and then sends it to the Server.
- Related Questions & Answers
- What is the difference between execute(), executeQuery() and executeUpdate() methods in JDBC?
- What is the difference between ODBC and JDBC
- What is the difference between scipy.cluster.vq.kmeans() and scipy.cluster.vq.kmeans2() methods?
- What is the difference between functions and methods in JavaScript?
- What is the difference between the TYPE_SCROLL_INSENSITIVE and TYPE_SCROLL_SENSITIVE ResultSets in JDBC?
- What is the difference between jQuery Ajax Events and Methods?
- What is the difference between non-static methods and abstract methods in Java?
- What is the difference between switchClass() and toggleClass() methods in jQuery?
- What is the difference between jQuery.hide() and jQuery.remove() methods in jQuery?
- What is the difference between jQuery.empty() and jQuery.remove() methods in jQuery?
- What is the difference between jQuery.prepend() and jQuery.prependTo() methods in jQuery?
- What is the difference between jQuery.replaceAll() and jQuery.replaceWith() methods in jQuery?
- What is the difference between jQuery.post() and jQuery.get() methods in jQuery?
- What is the difference between jQuery.load() and jQuery.ajax() methods in jQuery?
- What is the difference between jQuery.load() and jQuery.get() methods in jQuery?