| Author |
Upload file and store it in database
|
Sri Gnana
Ranch Hand
Joined: Apr 29, 2004
Posts: 166
|
|
Hi, Now i'm able to upload the file and store it in server, but i wanna store it in database, please give me an idea and url for reference.
|
Thanks & Regards
Sri Gnana
Everythings Programmed!...
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
Have a look at the interfaces java.sql.Clob and java.sql.Blob, then have a look at the setBinaryStream(int parameterIndex, InputStream x, int length) method of java.sql.PreparedStatement class. You should be able to work it out from there.
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56202
|
|
|
Moving to the JDBC forum.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Sri GS
Greenhorn
Joined: Apr 29, 2004
Posts: 3
|
|
|
Thanks
|
 |
Ali Gohar
Ranch Hand
Joined: Mar 18, 2004
Posts: 572
|
|
There are 2 ways to do that 1 - Store the path of the file in Database and then display the image using that path. It will be efficient and your database size will reasonably reduce. 2 - Store the actual image in database in the form of bytes and then read those bytes and make a file and then display that in your page. This technique is more reliable as compare to 1st because if path of the files changes or any file get deleted then there will raise problems. Its all depends on your requirements.
|
 |
 |
|
|
subject: Upload file and store it in database
|
|
|