• Post Reply Bookmark Topic Watch Topic
  • New Topic

Adding image path in mysql database  RSS feed

 
shaikh russell
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I would like to add multiple images for each item in the web page using spring boot mvc, hibernate JPA; not using jsp. How could this be done without adding images directly in the mysql db, but a link of the image, image name and size in the db would be fine. This way its easier to add and delete image links in the db. Images can be stored in this location in Intellij IDEA: \src\main\resources\images.

Does a new table need to be created or more columns need to be added in the existing tables. None of the tables has columns about images.
 
Paul Clapham
Sheriff
Posts: 22099
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the database point of view, you could easily store the image path, name, and size in a database table. The first two are just strings and the third is an integer value. Whether they would go in a new table or be new columns in an existing table depends entirely on the design of the database which you already have. Or you might just have one folder where images are stored, in which case the image path doesn't need to go in a database column.

As for where to put the images: I assume the server which uses that database is going to want to access the images? In that case putting the images on the same machine as the server would be helpful. If the images are on a different machine then you need to arrange for your software server to be able to access them across the network somehow. You mentioned Intellij IDEA but that's just your development environment. It's a mistake to tie anything in your application to your development environment because that will make it break when you deploy it to production.
 
Paul Clapham
Sheriff
Posts: 22099
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And, welcome to the Ranch!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!