Requirements for this program:
To store file into database we need following things::
1.     gwt-windows-1.7.1 (I just use this version to built this program another version is not worked properly).
2.     MySql or Wamp (It is a software that is provide MySql. So install one of them).
3.     MySql-Connector-jar file (It gives the facility to connect gwt-rpc to mysql database).
4.     Eclipse SDK (It is the IDE that is used to create a gwt project )
Steps:
First Step:
First we shall create a new project which name is TestExample  by Command Prompt.
G:\gwt-windows-1.7.1>webAppCreator  -out  TestExample  com.TestExample 
Now new project is created in gwt-windows-1.7.1.  But we can not code or design in this code. So we have to import this project into eclipse IDE.
File  => Import  => Existing Projects into Workspace =>  Choose Project    =>       Finish.
After importing your project into eclipse IDE you can code or design your project. Here you can give your suitable coding to store file or image into database mysql.
 Second Step:
Now we have to perform second step to add  mysql connector jar file (mysql-connector-java-5.1.6.jar)  This jar file is work to connect database to gwt-rpc. It provides driver that can load the database and create a connection that are used to store file into database by gwt.
Right Click on TestExample =>  Build Path=>  Add External Archives  =>      Select the jar (mysql-connector-java-5.1.6.jar) file    =>     Finish

Third Step:
In two steps all configuration is done in eclipse IDE. Now we have to focus on mysql to create table in which we want to store file. To store file into database table we need a data type that can store the bytes form of file in the table.
Command
Create table uploadfile (id int(5) NOT NULL auto_increment , topic text(30), stream text(15), tag text(30), publiclink text(30), filebody longblob);
NOT NULL:- Here Not null is used to protect id field form null value. It means that id can not contain the null value.
auto_increment:-  It is a mysql variable that gives the auto incremented integer value and this value filled automatic every time.
longblob:- It is the data type which can contain the bytes of file into data base and long gives the wide range to store file bytes.
Forth Step:
Now you just open TestExample project files and edit code or match this code which is giving as follows:
GreetingService.java
package com.client;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

/**
 * The client side stub for the RPC service.
 */
@RemoteServiceRelativePath("greet")
public interface GreetingService extends RemoteService {
      String upload(String topic, String stream, String Tag, String plink, String fpath );
}


               
GreetinServiceAsync.java
package com.client;

import com.google.gwt.user.client.rpc.AsyncCallback;

/**
 * The async counterpart of <code>GreetingService</code>.
 */
public interface GreetingServiceAsync 
{
  void upload(String topic, String stream, String Tag, String plink, String fpath, AsyncCallback<String> callback );
  
}

TestExample.java
package com.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.FileUpload;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class TestExample implements EntryPoint
{
private final GreetingServiceAsync a1 = GWT.create(GreetingService.class);
        RootPanel rt;
        AbsolutePanel absolutePanel;
        TextBox textBox;
        ListBox comboBox;
        TextBox textBox_1;
        TextBox textBox_2;
        FileUpload fileUpload;
        Button button;
        String s1,s2,s3,s4,s5;
      public void onModuleLoad()
      {
             
              rt=RootPanel.get();
             
              absolutePanel = new AbsolutePanel();
              rt.add(absolutePanel, 218, 24);
              absolutePanel.setSize("445px", "434px");
             
              textBox = new TextBox();
              absolutePanel.add(textBox, 143, 39);
             
              Label lblTopic = new Label("Topic");
              absolutePanel.add(lblTopic, 86, 42);
             
              comboBox = new ListBox();
              comboBox.addItem("Computer Science");
              comboBox.addItem("Environment");
              comboBox.addItem("Physics");
              comboBox.addItem("Chemistry");
              comboBox.addItem("Biology");
              absolutePanel.add(comboBox, 143, 88);
              comboBox.setSize("148px", "24px");
             
              Label lblStreams = new Label("Streams");
              absolutePanel.add(lblStreams, 69, 88);
             
              textBox_1 = new TextBox();
              absolutePanel.add(textBox_1, 143, 139);
             
              Label lblTags = new Label("Tags");
              absolutePanel.add(lblTags, 87, 139);
             
              textBox_2 = new TextBox();
              absolutePanel.add(textBox_2, 143, 194);
             
              Label lblPublicLink = new Label("Public Link");
              absolutePanel.add(lblPublicLink, 49, 194);
             
              fileUpload = new FileUpload();
              absolutePanel.add(fileUpload, 143, 254);


              button = new Button("New button");
              absolutePanel.add(button, 156, 311);
             
              button.addClickHandler(new ClickHandler()
              {
                  public void onClick(ClickEvent event)
                  {
                        Window.alert("onclick");
                        String topic=textBox.getText();
                   String strm=comboBox.getItemText(comboBox.getSelectedIndex());
                        String tag=textBox_1.getText();
                        String plink=textBox_2.getText();
                        String fpath=fileUpload.getFilename();
                 
        a1.upload(topic, strm, tag, plink, fpath, new AsyncCallback<String>() 
            {
                             
              @Override
             public void onSuccess(String result)
             {
                 // TODO Auto-generated method stub
                  String f="yes";
                  System.out.println(result);
                  // TODO Auto-generated method stub
                  if(result.equals(f))
                  {
                     System.out.println("onsuccess");
                     Window.alert("File Upload");
                                         
                  }
                  else
                  {
                     Window.alert("Filis not uploaded");
                  }
                       
           }
                             
           @Override
           public void onFailure(Throwable caught) 
            {
                  // TODO Auto-generated method stub
                  Window.alert("Failure");
            }
        });

      }
   });
              button.setText("Uplod lctr notes");
              button.setSize("133px", "28px");
             
              Label lblFile = new Label("File");
              absolutePanel.add(lblFile, 98, 254);
              lblFile.setSize("27px", "21px");

    }
}

GreetingServiceimp.java
package com.server;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import com.client.GreetingService;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;

/**
 * The server side implementation of the RPC service.
 */
@SuppressWarnings("serial")
public class GreetingServiceImpl extends RemoteServiceServlet implements
    GreetingService
{

     
      Connection con=null;
      Statement st=null;
      ResultSet rs=null;
      String query;
     
      String url="jdbc:mysql://localhost:3306/gwtlogin";
     
 public void call()
 {
       try
       {
             Class.forName("com.mysql.jdbc.Driver");
       }
       catch(ClassNotFoundException e)
       {
             System.out.print(e.getMessage());
       }
       try
       {
             con=DriverManager.getConnection(url, "root", "");
             st=con.createStatement();
       }
       catch(SQLException e)
       {
             System.out.println(e.getMessage());
       }
 }


      @Override
public String upload(String topic, String stream, String Tag, String plink,
                  String fpath) {
            // TODO Auto-generated method stub
            call();
            String ss="no";
            int k=0;
          FileInputStream fis = null;
          PreparedStatement pstmt = null;
       
          System.out.println(fpath);
          try
          {
            System.out.println("Hello try");
            con.setAutoCommit(false);
            File file = new File(fpath);
            fis = new FileInputStream(file);
            pstmt = con.prepareStatement("insert into uploadfile(Topic, Stream, Tag, PublicLink, FileBody ) values ( ?, ?, ?, ?, ?)");
            //pstmt.setString(1, id);
            pstmt.setString(1, topic);
            pstmt.setString(2, stream);
            pstmt.setString(3, Tag);
            pstmt.setString(4, plink);
            pstmt.setAsciiStream(5, fis, (int) file.length());
            k=pstmt.executeUpdate();
            System.out.println("Bye");
            if(k==1)
                  {
                        ss="yes";
                       
                  }
            con.commit();
          }
          catch (Exception e)
          {
            System.err.println("Error: " + e.getMessage());
            e.printStackTrace();
          }
          finally {
              try {
                        pstmt.close();
                  } catch (SQLException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                  }
              try {
                        fis.close();
                  } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                  }
              try {
                        con.close();
                  } catch (SQLException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                  }
            }
         
          return ss;
      }

}

 I hope you will able to store file into database. If any error has occurred or any question comes in your mind. Freely ask your problem by comment we just solve your problem within 1 hour.