Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
P Arunkumar
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • 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.
 
Scott Selikoff
author
Saloon Keeper
Posts: 4009
18
Eclipse IDE Flex Google Web Toolkit
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • 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
  • 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 Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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).
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic