How to store a file in the database with Grails

前端 未结 5 820
鱼传尺愫
鱼传尺愫 2021-01-12 23:55

I need to store a file in the database using Grails. So, do you know how I can do that? Which data type should I use in the domain class (byte[] might be a solution)?

5条回答
  •  鱼传尺愫
    2021-01-13 00:26

    I have had the same problem. All I needed to do was to go to the database (Oracle) and change the column type from RAW to Blob. (Actually I had to remove the column and then to create a new one). I was never able to find out how to use a "java.sql.Blob" as suggested above. I found this this (converting from bytes to Blob), but it seemed a bit complicated.

提交回复
热议问题