I have several applications written in Approach Release 9 which I would like
to view jpeg images from within Approach. I do not want to cut and paste
each image into Approach picture plus fields because there are too many
files.
Could I use IBM DB2 tables to store my jpeg files and open up each one
directly within Approach on a form that includes all relating data and
numeric fields pertaining to each image?
If so, how easy is it to import the jpeg files from a directory siting on
our NT server into DB2 tables? Could it be done on mass or must each image
be imported individually?
DataLinks enable DB2 databases to manage content that is stored in
external file systems. Read more about it on the IBM website
(http://www.ibm.com/software/data/db2) or ask your friendly IBM
salesperson. An older whitepaper on datalinks is at
http://www-4.ibm.com/software/data/pubs/papers/datalink.html
Daniel Jenson writes:
DJ> I am considering purchasing DB2 but I have several questions I need answered
DJ> first...
DJ> I have several applications written in Approach Release 9 which I would like
DJ> to view jpeg images from within Approach. I do not want to cut and paste
DJ> each image into Approach picture plus fields because there are too many
DJ> files.
DJ> Could I use IBM DB2 tables to store my jpeg files and open up each one
DJ> directly within Approach on a form that includes all relating data and
DJ> numeric fields pertaining to each image?
DJ> If so, how easy is it to import the jpeg files from a directory siting on
DJ> our NT server into DB2 tables? Could it be done on mass or must each image
DJ> be imported individually?
DJ> DJ
DJ> www.christian-bernard.com
--
Regards,
--
Haider
Disclaimer: I don't speak for IBM.
Note: To reply, remove no_uce from my email address
#include <stdio.h>
#include <stdlib.h>
#include <sql.h>
#include "util.h"
EXEC SQL INCLUDE SQLCA;
#define CHECKERR(CE_STR) check_error(CE_STR, &sqlca);
EXEC SQL BEGIN DECLARE SECTION;
long image_index;
char filename[80];
char oldfilename[80];
SQL TYPE is BLOB_FILE b_image_jpeg;
SQL TYPE is BLOB_FILE b_image_thumb;
EXEC SQL END DECLARE SECTION;
int main(int argc, char * argv[])
{
char *pfileholder, pspace_pos;
FILE *pfholder;
int len, pos, tempi;
if(argc!=2){
printf("Usage: batchinput file-holder-name\n");
exit(-1);
}
pfileholder=argv[1];
if((pfholder=fopen(pfileholder, "r"))==NULL){
printf("Error in opening file %s\n", pfileholder);
exit(-1);
}
EXEC SQL CONNECT TO YOURDB;
image_index=0;
while(fgets(oldfilename, sizeof(oldfilename), pfholder)!=NULL){
tempi=0;
while(tempi<sizeof(oldfilename)){
if((oldfilename[tempi]==' ')||(oldfilename[tempi]=='\n'))break;
filename[tempi]=oldfilename[tempi];
tempi=tempi+1;
}
filename[tempi]='\0';
printf("reading: %s.", filename);
/* Doing image data loading */
memset((void *)b_image_jpeg.name, sizeof(b_image_jpeg.name), '\0');
strcpy(b_image_jpeg.name, "/home/facerec/images/jpeg/");
strcat(b_image_jpeg.name, filename);
strcat(b_image_jpeg.name, ".jpg");
b_image_jpeg.name_length=strlen(b_image_jpeg.name);
b_image_jpeg.file_options=SQL_FILE_READ;
image_index++;
EXEC SQL insert into imagedata(image_index, image_jpeg)
values(:image_index, :b_image_jpeg);
if(SQLCODE==0)EXEC SQL commit;
else EXEC SQL rollback;
/* loading the next file name */
memset((void *)filename, sizeof(filename), '\0');
memset((void *)oldfilename, sizeof(oldfilename), '\0');
}
EXEC SQL CONNECT RESET;
fclose(pfholder);
}
In article <jh0N4.81381$q67.1...@newsread2.prod.itd.earthlink.net>,
"Daniel Jenson" <jenson...@usa.net> wrote:
> I am considering purchasing DB2 but I have several questions I need
answered
> first...
>
> I have several applications written in Approach Release 9 which I
would like
> to view jpeg images from within Approach. I do not want to cut and
paste
> each image into Approach picture plus fields because there are too
many
> files.
>
> Could I use IBM DB2 tables to store my jpeg files and open up each one
> directly within Approach on a form that includes all relating data and
> numeric fields pertaining to each image?
>
> If so, how easy is it to import the jpeg files from a directory siting
on
> our NT server into DB2 tables? Could it be done on mass or must each
image
> be imported individually?
>
> DJ
> www.christian-bernard.com
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.