how can i insert image in matisse database using SQL query?

102 views Asked by At

i have to insert an image into the matisse database. how can i insert it through sql insert statement in java?

1

There are 1 answers

6
fireandfuel On

You can use a java.sql.PreparedStatement to insert a blob into your database.

Example code:

 try{
      Connection con = getYourDatabaseConnection();
      PreparedStatement statement = con.prepareStatement("INSERT INTO YOUR_TABLE(YOUR_BLOB_COLUMN) VALUES (?)";
      statement.setObject(1, yourImage);
      statement.execute();
 } catch(SQLException e){
      e.printStackTrace();
 }