This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Help-I want to store char array data as blob in the database??  RSS feed

 
Emre Günertürk
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody.I'm new here and programming.I wanted to write a servlet that is triggered by html page submitting.I want to chose a file from my file system read it as binary data and store it as blob data type in my database.I do some search but cant find a proper solution.I managed to read data and return binary data in request body but now i want to simply store that data in database.I used buffered reader to read data but i am not sure at all.Here's my code below first my html :

And servlet that reads file and returns it in the request body:
 
Rob Spoor
Sheriff
Posts: 21090
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you checked out java.sql.PreparedStatement and java.sql.ResultSet? They can handle both binary and ASCII streams.

However, I think a CLOB (if available) or a long text field would seem better. BLOB is a binary large object, better suited for binary data. A long text and CLOB (character large object) are designed for handling large amounts of text.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!