Results 1 to 3 of 3
- 04-05-2011, 01:58 AM #1
Member
- Join Date
- Mar 2011
- Location
- malaysia
- Posts
- 9
- Rep Power
- 0
- 04-05-2011, 08:30 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
You have a stream for the uploaded file, just use that in the insert query (setBinaryStream() in PreparedStatement). No need to go via disk.
- 04-05-2011, 10:19 AM #3
Senior Member
- Join Date
- Apr 2010
- Location
- Dhaka,Bangladesh
- Posts
- 178
- Rep Power
- 0
BLOB is not needed.You can make a table with a single field parameter TEXT.And you can upload a .text from your desktop on it using FILE class .
Java Code:String fileName ="C:/insert.txt"; File file = new File(fileName); FileInputStream fis = new FileInputStream(file); pstmt = conn.prepareStatement("insert into tablename(columnname) values (?)"); pstmt.setAsciiStream(1, fis, (int) file.length()); pstmt.executeUpdate();Don't Forget to try yourself before asking others help.....
Press REP, if you find their advices/solutions effective.
Similar Threads
-
JDBC MySql question
By santa in forum New To JavaReplies: 12Last Post: 01-18-2011, 03:47 PM -
com.mysql.jdbc.Driver
By uthpalaw in forum EclipseReplies: 2Last Post: 10-14-2010, 05:09 AM -
:large file upload to server(chunk upload)
By tommy_725 in forum NetworkingReplies: 0Last Post: 10-16-2009, 12:21 AM -
MySQL/JDBC Mysql query output
By thelinuxguy in forum Advanced JavaReplies: 4Last Post: 02-13-2009, 01:57 AM -
help ... JDBC or PHP/MySQL
By bluebarca in forum Advanced JavaReplies: 1Last Post: 11-16-2007, 10:05 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks