How do I store a picture in MySQL?

前端 未结 2 1570
小蘑菇
小蘑菇 2021-02-09 21:44

I want to store an image in a MySQL database. I have created a table with a BLOB datatype, but now how do I store the image in this table?

2条回答
  •  终归单人心
    2021-02-09 22:36

    read the content of the file (BINARY) and insert it in insert \ update MYSQL query

    a lot of example in google :

    http://www.java2s.com/Code/Java/Database-SQL-JDBC/InsertpicturetoMySQL.htm

    http://www.roseindia.net/jdbc/save_image.shtml

    http://www.jguru.com/faq/view.jsp?EID=1278882

提交回复
热议问题