This week's book giveaway is in the Java 9 forum.
We're giving away four copies of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications and have Sander Mak & Paul Bakker on-line!
See this thread for details.
Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

saving a file into postgresql (from form)  RSS feed

 
ronald silva
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?
 
Dave Tolls
Ranch Foreman
Posts: 2996
37
  • 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!