• +91 9723535972
  • info@interviewmaterial.com

JDBC Interview Questions and Answers

Question - How Do I Insert An Image File (or Other Raw Data) Into A Database?

Answer -

All raw data types (including binary documents or images) should be read and uploaded to the database as an array of bytes, byte[]. Originating from a binary file,

  • Read all data from the file using a FileInputStream.
  • Create a byte array from the read data.
  • Use method setBytes(int index, byte[] data); of java.sql.PreparedStatement to upload the data.


Show all Coment

Leave a Comment

NCERT Solutions


Share your email for latest updates


Our partners