Hello Many thanks for your reply.My database table structure is like this.I have 3 
fields in the table and field i want to insert file is 'execute'
 
Table Name ::submitjobs

Field               Type      
CPU               varchar(25) 
Architecture    varchar(25) 
execute           blob       
 
The file name i want to insert into the filed 'execute' is 'ravu.txt'.I didn't 
understood this statement properly.Can you explain this with respect to my above table 
structure.
 
PreparedStatement prestate = websiteDBCon.prepareStatement("" +
"INSERT INTO Collateral (AccountTypeID," +
"Document" +
"VALUES (?)");
 
 
Thank you very much for your time and patience,
Pl reply.
Maruthi.
 

Mike Fowler <[EMAIL PROTECTED]> wrote:
Hi Maruthi,

This should do what your after. The variable file is obviously the
file you want to insert into the database.

PreparedStatement prestate = websiteDBCon.prepareStatement("" +
"INSERT INTO Collateral (AccountTypeID," +
"Document" +
"VALUES (?)");

//make sure the statement is clear
prestate.clearParameters();

//add the file to the statement
prestate.setBinaryStream(1, //parameter reference
new FileInputStream(file), //file to insert
(int) file.length()); //length of file

//excute the statement
prestate.execute();

Hope this helps!

-Mike Fowler
"I could be a genius if I just put my mind to it, and I,
I could do anything, if only I could get 'round to it"


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


                
---------------------------------
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.

Reply via email to