Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: storing images mySQL using java swing

  1. #1
    Join Date
    Apr 2014
    Thanked 2 Times in 2 Posts

    Default storing images mySQL using java swing

    I am making a database, not a very big one, it has 5 tables. I want to store an image on the database but I have been reading this is bad practice. However it fails to say why, and what is the better method in handling them. I currently have my table set up to take the picture as a LONGBLOB. Any advice?

  2. #2
    Super Moderator
    Join Date
    Jun 2013
    So. Maryland, USA
    My Mood
    Thanked 697 Times in 679 Posts

    Default Re: storing images mySQL using java swing

    Thread moved.

  3. #3
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Thanked 832 Times in 772 Posts
    Blog Entries

    Default Re: storing images mySQL using java swing

    but I have been reading this is bad practice
    Images cannot technically be normalized, so traditionally speaking one can make the argument that they belong in the file system rather than something that best works with data that can be normalized. Further, images tend to be large (relatively speaking) - thus insertion and removal can result in table overhead, and - depending upon the database - if the data is large insertion/deletion can cause tables to lock which prevents others from modifying the table until the lock is released. Lastly - depending upon the infrastructure - network overhead may be experienced if the database resides in a different location than the client making the SQL call. In short, one could sum up the above points by saying that storing images in a database does not scale well. The alternative way is to store the photo on the file system and place the path to the file within the appropriate location in the database.

Similar Threads

  1. [SOLVED] Putting images in GUI. Images in source file dont seem to be recognised.
    By nikolaiL in forum What's Wrong With My Code?
    Replies: 1
    Last Post: June 8th, 2014, 02:44 PM
  2. Printing Images using java
    By lsorsby in forum What's Wrong With My Code?
    Replies: 0
    Last Post: July 17th, 2013, 09:13 AM
  3. Vector Images in Java
    By preeyasiva@gmail.com in forum AWT / Java Swing
    Replies: 1
    Last Post: August 9th, 2012, 10:25 AM
  4. Reading a txt file and storing them in a Java Array
    By FrozenFox in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: July 27th, 2012, 07:19 AM
  5. storing class in mysql
    By junnam in forum JDBC & Databases
    Replies: 1
    Last Post: September 20th, 2011, 06:16 PM