
- 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
How to convert Byte Array to BLOB in java?
You can convert a byte array to blob bypassing byte array to the constructor of the SerialBlob class.
Example
import java.io.BufferedReader; import java.io.FileReader; import java.sql.Blob; import java.util.Scanner; import javax.sql.rowset.serial.SerialBlob; public class ByteArrayToBlob { public static void main(String args[]) throws Exception { Scanner sc = new Scanner(new BufferedReader(new FileReader("myData"))); Blob blob = null; while(sc.hasNext()) { byte[] myArray = sc.nextLine().getBytes(); blob = new SerialBlob(myArray ); } } }
- Related Questions & Answers
- How to convert BLOB to Byte Array in java?
- How to convert Byte Array to Image in java?
- How to convert Image to Byte Array in java?
- How to convert InputStream to byte array in Java?
- How to convert a PDF to byte array in Java?
- How to convert an object to byte array in java?
- How to convert java bitmap to byte array In android?
- How to convert hex string to byte Array in Java?
- Java Program to convert byte[] array to String
- Java Program to convert String to byte array
- Convert byte Array to Hex String in Java
- Convert Hex String to byte Array in Java
- How to convert an input stream to byte array in java?
- How to convert a byte array to hex string in Java?
- Java program to convert Byte array to IP Address
Advertisements