This week's book giveaway is in the iOS forum.
We're giving away four copies of Classic Computer Science Problems in Swift and have David Kopec on-line!
See this thread for details.
Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

saving a file into postgresql (from form)  RSS feed

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi.
how do I save a file into postgresql?
I am using those codes:
jsp:


and the servlet:



my doubt is in this last line: ps.setBinaryStream (1,contarq, (int)contarq.available() ); 
can not save a inputstream directly in postgresql?

oh, the database in postgresql has a table (images) and a column (img) type bytea.

what I need to edit in those codes , in order that works?
 
Rancher
Posts: 3456
39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What error do you get?

Have you tried just saving the file to disk on the server to see that it is transmitted correctly?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!