aspose file tools*
The moose likes JDBC and the fly likes Attaching Pictures Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply locked New topic
Author

Attaching Pictures

Rohan Kalra
Greenhorn

Joined: Jun 28, 2010
Posts: 7
So I don't know how much this falls under the JDBC category but if I am using JDBC to connect my Java application to a MySQL database, how can I add functionality for attaching pictures to this application?
Any advice would be much appreciated.
Thanks,
Rohan
Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

Rohan Kalra wrote:So I don't know how much this falls under the JDBC category but if I am using JDBC to connect my Java application to a MySQL database, how can I add functionality for attaching pictures to this application?
Any advice would be much appreciated.
Thanks,
Rohan


need more info. Where are the pictures coming from and where are they going to? Are you talking about users uploading pictures?
Rohan Kalra
Greenhorn

Joined: Jun 28, 2010
Posts: 7
So it's like a mock-up of a prison system. A very basic one. Say the prison official using it enters details of crimes and inmates and then wants to attach pictures to the inmate details. He has the image files on his computer, but he just wants to attach the correct file to an inmates profile.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41874
    
  63
Is this a desktop app or a web app?


Ping & DNS - my free Android networking tools app
Rohan Kalra
Greenhorn

Joined: Jun 28, 2010
Posts: 7
desktop
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30537
    
150

Rohan,
The first thing to decide is whether you want the pictures in the database or on the server with a path to the picture in the database.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Rohan Kalra
Greenhorn

Joined: Jun 28, 2010
Posts: 7
So I figured it would probably be better to have the pictures on the server or even the local machine since the pictures will be used by only one section/division. I'm not exactly sure how this works to be honest but I do realize that putting in a couple of pictures for every entry will probably take up too much space on a database.
Rohan Kalra
Greenhorn

Joined: Jun 28, 2010
Posts: 7
So anyone have any idea at all? I skipped this for a few days but still failed when i tried some stuff last night, probably cause I have no idea. I want to be able to add images to my Java Application that uses JDBC to connect to a MySQL database. The images will be stored on the local machine, not on the server. Thanks.
Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

Rohan Kalra wrote:So anyone have any idea at all? I skipped this for a few days but still failed when i tried some stuff last night, probably cause I have no idea. I want to be able to add images to my Java Application that uses JDBC to connect to a MySQL database. The images will be stored on the local machine, not on the server. Thanks.


share what you have tried. What code are you using to get images from local filesystem?
Lalit Mehra
Ranch Hand

Joined: Jun 08, 2010
Posts: 384

i would suggest you better use path to the image files because otherwise it will take quite some space on the database itself ... and it's easy too as you just have to read the files location but then you will need to employ certain mechanism to read those files from their respective locations every time the view changes

but as you are probably going to save those image files on the desktop machine itself you can this shouldn't be much of an issue ...

anyways you should google about which format mySQL uses for images ... and you can then easily retrieve the images from there using the "blob" type ... JDBC

i think mySQL uses bit type but i'm not sure


http://plainoldjavaobject.blogspot.in
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2500
    
    8

If you want the pictures stored on the local machine, then this is not a JDBC related post.
JDBC implies that you want to store the image on the database server, but you don't want that.




OCUP UML fundamental and ITIL foundation
youtube channel
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8908
    
    8

The conversation continues here.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Attaching Pictures