• 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

how to upload files to My sql with jsp and what is the query to check in database

 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I need to upload some files to database(mysql), i developed my presentation logic by jsp. iam new to development field, please help me how i can upload files in database with example.


i have created my database table as : Create table file(file_data mediumblob);

What java code to upload file in database, after uploading in database what query i can use to check in database.


Please help me,Its my first project, i Don't have any guide to solve my problem, please help me.


Thanks in advance,

Thanks & Regards,
Jenifer Rajkumar.
 
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I recommend trying to upload a file to a database without using a JSP to get some practice, then combine it with a JSP for the full solution (without putting JDBC inside of a JSP as this is a horrible practice).
 
P Arunkumar
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Thank you for kind information,

i don't know how to upload a file in database, it can be with java also for me great fine. but i need to upload or store some files into the database.

Please send me with some example, because iam beginner and new to java.


Thank you in advance.
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jenifer Rajkumar wrote:Please send me with some example, because iam beginner and new to java.


This is what tutorials have been invented for. Anyone trying to access database from Java should read a JDBC tutorial thoroughly. You might try this tutorial, for example.

Files are usually stored in BLOB fields and blobs manipulation is covered by most JDBC tutorials. Searching for "BLOB" here on Javaranch will undoubtedly bring up some examples too. If something is still unclear afterwards, come back here and ask specific questions; you'll obtain much better response that way.
 
P Arunkumar
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi


I read the tutorial, but still i can't get answer for my question please help me to upload file into database useing java.

Please send me a bit of code to upload file,


Thanks in advance.
 
Martin Vashko
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jenifer Rajkumar wrote:I read the tutorial, but still i can't get answer for my question please help me to upload file into database useing java.


The tutorial contains lots of examples, including ones regarding CLOBs/BLOBs. Didn't you see them?

Look carefully at the code examples in the tutorial. If something is not clear, try reading the Java documentation of the methods that seem unclear to you. If it's still hazy, come back here, show us the code you've written and tell us what does not work as you'd expect. We'll be glad to answer specific question.

You might also want to read ShowSomeEffort, NotACodeMill or generally all in the HowToAskQuestionsOnJavaRanch (just click on these words).
 
reply
    Bookmark Topic Watch Topic
  • New Topic