Imagecontroller.java, Imagedatabase.java, Imagecontroller.java imagedatabase.java – HP Integrity NonStop H-Series User Manual
Page 164
#jdbc.url=jdbc:sqlmx://
#jdbc.username=
#jdbc.password=
#-------------------------------------------------------------------------------
# SQL/MX Settings for JDBC Type 4 Driver
#jdbc.driverClassName=com.tandem.t4jdbc.SQLMXDriver
#jdbc.url=jdbc:t4sqlmx://
#jdbc.username=
#jdbc.password=
#For JDBC Type 4 Driver:
#
#
#
#
ImageController.java
(
web\ImageController.java)
:
This is the
MultiActionController
controller class that contains the
RequestMapping
for
the request for Insertion, Retrieval, and Deletion. BLOB is not directly supported by the SQL/MX
database; it is handled by the BLOB/CLOB handler classes in the SQL/MX driver
JAR
file. This
class is modified to use the BLOB.
Changes to the
ImageController.java
file
Before the change:
@RequestMapping("/imageUpload")
public String processImageUpload(@RequestParam("name") String name,
@RequestParam("description")
String description,@RequestParam("image") MultipartFile image)
throws IOException
{
this.imageDatabase.storeImage(name, image.getInputStream(),
(int) image.getSize(), description);
return "redirect:imageList";
}
After the change:
@RequestMapping("/imageUpload")
public String processImageUpload(@RequestParam("name") String name,
@RequestParam("description")
String description,@RequestParam("image") MultipartFile image)
throws IOException
{
this.imageDatabase.storeImage(name, image.getBytes(),
description);
return "redirect:imageList";
}
ImageDatabase.java
(
\web\ImageDatabase.java)
:
This is the central business Java interface of ImageDB. It contains method signatures that are
used by ImageDB. BLOB is not directly supported by the SQL/MX database; it is handled by the
BLOB/CLOB handler classes in the SQL/MX driver JAR file. This class is modified to use BLOB.
Changes to the
ImageDatabase.java
file
Before the change:
164
Customizing Sample Applications