• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

uploading image into myslq through servlet WAS: uploading image into oracle database

 
michael dizon
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Scott Duclos was kind enough to show me how to upload an image into an oracle database. Only now I discovered that it must be inserted into a mysql database instead.
So how does one insert an image into mysql through a servlet? I'm assuming that much will be the same as what is posted in Scott's post, but there seems to be alot of reliance on the oracle api.
 
Scott Duclos
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike, I'm not sure of the exact code to insert into MySQL, but this
will probably work. Turn the image into a base64 encoded String so that
it can easily be stored in a large character field in MySQL. Then decode
when the image is selected out. This should work with most Databases.
If performance is a major issue then this might not be the best solution as
there is the extra decode step.
--- Images --------------
image_id NUMBER( 14 )
image_name VARCHAR2( 50 )
image CLOB or the equivalent in MySQL
-------------------------

---- Upload image servlet --------

Scott
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic