sakthi's blog
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
Posted at 03:03PM Jan 27, 2006 by sakthi in Creator | Comments[2]
Posted by legolas woodlan on February 07, 2006 at 02:54 PM PST #
<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 12:26 PM PDT #