on 01-14-2009 3:40 AM
REPOSTING; Need help
Hello all,
I have already gone through the tutorials available here as for uploading files. My application uploads text files and parses (buffer reads) it and insert into a varchar2 field. But the requirement changed: Now, the files allowed for upload is of any file type.
Now the problem with the tutorial I have is that it stores the files on the project's folder - and I see it as not applicable to my application. Hence, I decided to store it onto a BLOB field on an Oracle databse.
I looked into Bean Managed Persistence - but I can't figure a way to have it inserted into the database.
I'm using WebDynpro. How do I do this, please?
Thank you.
Regards,
Jan
-
I have already been able to bind the file to value attribute of FileSource -- what should I do next to have this inserted to the BLOB field?
Thank you in advance.
-Jan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
See If the Below Code can help you.
Inserting a BLOB
// CREATE TABLE t1 (c1 INT PRIMARY KEY NOT NULL, c2 BLOB(5M));
PreparedStatement pstmt = conn.prepareStatement ("INSERT INTO t1 VALUES (?,?)");
pstmt.setInt (1, 100);
File fBlob = new File ( "here you can pass your file );
FileInputStream is = new FileInputStream ( fBlob );
pstmt.setBinaryStream (2, is, (int) fBlob.length() );
pstmt.execute ();
...
please revert if you require more info
Regards
Narendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.