How to store a file in a mysql database using blob

后端 未结 2 1714
名媛妹妹
名媛妹妹 2020-12-18 17:22

I have searched about this matter a lot but, I didn\'t get a proper solution for my problem, I have following method for storing a file using java,

private v         


        
相关标签:
2条回答
  • 2020-12-18 17:56

    Try this

    File fBlob = new File ("<your_path>");
    FileInputStream is = new FileInputStream(fBlob);
    statement.setBinaryStream(1, is, (int) fBlob.length());
    statement.execute();
    
    0 讨论(0)
  • 2020-12-18 17:59

    convert the file data into byte array and set in the sql statement

    0 讨论(0)
提交回复
热议问题