• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic