File Upload to MySQL Database

Hello!
I want to upload my file to a mysql database and not to the filesystem. I used the description on http://vaadin.com/book/-/page/components.upload.html to create an upload example for storing it into the filesystem. What do I have to change if I want to store it in the database, I did not find any example on the website how to handle this?

I am very happy for any help!
Florian

Easiest is to upload using ByteArrayOutputStream and then move the bytes to your database blob using outputStream.toByteArray()

Thank you for yout respone. I thought the same but I have the problem how to do that. This is my current code:


// Callback method to begin receiving the upload.
	public OutputStream receiveUpload(String filename,
              String MIMEType) {

		FileOutputStream fos = null; // Output stream to write to
		file = new File("C:/Users/Florian/" + filename);
		byte[] bFile = new byte[(int) file.length()]
;
		try {
			// Open the file for writing.
			fos = new FileOutputStream(file);
		} catch (final java.io.FileNotFoundException e) {
			// Error while opening the file. Not reported here.
			e.printStackTrace();
			return null;
		}

		return fos; // Return the output stream to write to
	}

Where can I get the output stream?
Thanks,
Florian

Okay finally I could resolve the problem. I wrote the solution to my wiki. I do not know if this is wished by the moderators but here is the link to the article. If wished I can also write the articel to this forum.

Link:
http://wiki.nettania.at/xwiki/bin/view/Vaadin/Simple+File+Upload

Florian Tomsarian your link does not work, can you post the solution here.