• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Image File not inserted in MySql DB

 
Ranch Hand
Posts: 1346
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

an image I am choosing with a JFileChooser (Swing) is not inserted in the DB. The debugging flux is ok and it doesnt launch any error in the console.







The other rows in the DB are filled correctly with the data I introduce in the user form with the exception of the "user_file". The table structure is attached.


tableStructure.PNG
[Thumbnail for tableStructure.PNG]
 
Saloon Keeper
Posts: 5765
146
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There may be something wrong with "inputStream" - where does that come from? Is it valid?
 
Angus Ferguson
Ranch Hand
Posts: 1346
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

There may be something wrong with "inputStream" - where does that come from? Is it valid?



I was casting length to inputStream and it was not valid.




A better approach I would say is to save the file into file system and put file name into db like this;



Now it works correctly.

 
Evil is afoot. But this tiny ad is just an ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!