How to upload and retrieve BLOB Datatypes to/from database?

It is very common among web applications to upload files like Images, PDF’s into database and retrieve them when user needs to view those files. This Creator 2 Project zipfile available here demos this task.

  • Download and extract the project zip into a directory
  • Create a table DEMO_BLOB in PointBase Order datasource i.e., Invoke View Data on Order Datasource in Servers window. Copy & paste this SQL and click RunQuery button to execute the command. This SQL creates the required table in PointBase sample database PBPUBLIC schema.

CREATE TABLE DEMO_BLOB (
IDCOL INTEGER IDENTITY (1,1) PRIMARY KEY,
BLOBCOL BLOB)

  • Open the project in Creator and Click on Run Main Project (aka Green Arrow) toolbar button

  • Click Browse and choose an image file. A few sample images files are available in the project at $Demo_Blob/web/sample_images folder

  • Click Upload Button to updload this into database. It also retrieves back all the images in this database table and displays using in a table component.

What’s wired in this project:

  • DisplayServlet that pulls the image for a given ID.

  • Upload Button action handler inserts a row with the imagefile into database table DEMO_BLOB.

  • Image component in the table uses the DisplayServlet URL to retrieve the image from database

  • Servets and servlet-mappings have been declared in WEB-INF/web.xml

screenshot - click to see full size

Comments:

Hi How i can have file upload inside a portlet please ? is there any way to implement file upload inside portlets ? Thanks

Posted by legolas woodlan on February 07, 2006 at 06:54 AM PST #

Refer File Upload Component - Tutorial This document states:
<quote> Note: This component is neither supported by nor available in portlet projects due to security reasons. </quote> -Sakthi

Posted by Sakthi on May 19, 2006 at 05:26 AM PDT #

Post a Comment:
Comments are closed for this entry.
About

sakthi

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today