• Monday , 27 January 2020

Java JDBC Tutorial – Part 11: CLOB – Reading and Writing CLOB with MySQL

Code Canyon

NEED TO LEARN JAVA? – 5 FREE JAVA VIDEO COURSES – CLICK HERE – https://goo.gl/7i95F8 — View more videos on my “Java JDBC Tutorial” Playlist: …

Original source

3d Ocean

Related Posts


  1. h4sh92
    February 11, 2019 at 19:41

    For people, who will not download the source code. When you try to read CLOB, keep in mind that you have to close the writer:


  2. Jonathan Blik
    February 11, 2019 at 19:41

    hi. thank you for your videos 🙂
    Could you tell me how to get rid of this kind of excepton
    java.sql.SQLException: Incorrect string value: 'xEFxBBxBFFUC.. ?

  3. The Aman
    February 11, 2019 at 19:41

    Hello chad,, file completed successfuly but the text file is completely blank….

  4. pradip318
    February 11, 2019 at 19:41

    hello luv2code , I am getting following exception:Exception in thread "main" java.io.FileNotFoundException: New Text Document.txt (The system cannot find the file specified)Could you please tell me where we suppose to store file in local drive?

  5. Reem Kamal
    February 11, 2019 at 19:41

    Hello ,

    I wrote this simple code to read from blob file in the database and write to a local file .
    it creates a local file but it doesn't write on it , i don't know what i miss.


    import java.io.*;
    import java.sql.*;

    public class ClobsWriteFileToDB {

    public static void main(String[] args) {

    String url = "jdbc:mysql://localhost:3306/testschema";
    String user = "root";
    String pass = "isoft123";
    try {
    Connection myConn = DriverManager.getConnection(url, user, pass);

    String sql = "select cv from test where id=2";

    Statement myStmt = myConn.createStatement();

    ResultSet myRs = myStmt.executeQuery(sql);

    File theFile = new File("outPutSamlple.txt");
    FileWriter output = new FileWriter(theFile);

    if (myRs.next()) {

    Reader input = myRs.getCharacterStream("cv");
    int theChar;
    while ((theChar = input.read()) > 0) {

    } catch (Exception e) {
    // TODO Auto-generated catch block



  6. Ganesh Godshelwar
    February 11, 2019 at 19:41

    can we store videos in database? how?

  7. Oleksandr Yefymov
    February 11, 2019 at 19:41

    Thanks, perfect videos! With your help i've learned JDBC ^) Thinking what to study then, jsp or hibernate…What do you think?

  8. Ahmad Sedeek
    February 11, 2019 at 19:41

    so basically the main difference between BLOB and CLOB is BinaryStream and CharacterStream ? (in javaCode)

  9. sandy
    February 11, 2019 at 19:41

    i want to store data from <textarea> tag of html to oracle database as a CLOB object.will u please help. my email id is diahard4.0@gmail.com

  10. M L
    February 11, 2019 at 19:41


Leave A Comment

You must be logged in to post a comment.