473,387 Members | 1,553 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How can I upload a BLOB/CLOB into a DB2 UDB Column?

25
Hi all,
I have a table define as: col1 int
col2 BLOB
col3 TIMESTAMP
I have several JPEG,GIF, etc photos that I want loaded into this table. I am searching for a shareware tool or sample code that I can use to load the BLOB data. Can anyone recommend a tool or share a free and straight forward SQL code that can do binary large object load.

Iam working with UDB 8.2 fixpak 14 and soon to go UDBv9.5.

Any assistance in this problem will be highly appreciated.

Thanks
Jan 29 '08 #1
6 7750
sakumar9
127 Expert 100+
You can refer to these samples:
SQLLIB/samples/c/dtlob.sqc
SQLLIB/samples/cli/dtlob.c
SQLLIB/samples/java/jdbc/dtlob.java

depending on the language that you are using. These samples demonstrates how we can upload BLOB/CLOB into any Db2 column.

Please let me know if the sample was useful to you or you need some more information.

Thanks and Regards
----Sanjay
Jan 30 '08 #2
okonita
25
You can refer to these samples:
SQLLIB/samples/c/dtlob.sqc
SQLLIB/samples/cli/dtlob.c
SQLLIB/samples/java/jdbc/dtlob.java

depending on the language that you are using. These samples demonstrates how we can upload BLOB/CLOB into any Db2 column.

Please let me know if the sample was useful to you or you need some more information.

Thanks and Regards
----Sanjay
Hello Sanjay,
Thanks for pointing out the sample files. I need further assistance. What do I need to be able to used the sample for my purpose. I have a DB2 UDBv8.2 and v9.1 on both Linux and Windows. I am more comfortable using windows and the Control Center or the Command line interface (CLI). So, what the steps that I need to take to (a) prepare the sample programs (b) prepare the JPEGS and other .GIF files that I want to upload and (c) what are the execution command to make this all work? As much detail as you can will be very much appreciated.

Thanks
Feb 7 '08 #3
sakumar9
127 Expert 100+
Hi Okonita,

Actually these samples can be executed on command line. (both windows and linux).

This sample first SELECT the blob(images) from sample database and then inserts these image files as blob into the database.

I would suggest you to try out these samples (whichever language you are comfortable with).,
All you need is a c compiler, and sample database (use "db2sampl" command to create the sample database. Let me know if you have any issues in executing the samples.

I would suggest you to refer to the README that is present in the same directory. This README has clear instructions for executing the samples.


Gud Luck....

Regards
--- Sanjay
Feb 7 '08 #4
okonita
25
Hi Okonita,

Actually these samples can be executed on command line. (both windows and linux).

This sample first SELECT the blob(images) from sample database and then inserts these image files as blob into the database.

I would suggest you to try out these samples (whichever language you are comfortable with).,
All you need is a c compiler, and sample database (use "db2sampl" command to create the sample database. Let me know if you have any issues in executing the samples.

I would suggest you to refer to the README that is present in the same directory. This README has clear instructions for executing the samples.


Gud Luck....

Regards
--- Sanjay
Okay, Sanjay, thanks again and I will try my hand at it as soon as I finish an installation...
Feb 7 '08 #5
okonita
25
Okay, Sanjay, thanks again and I will try my hand at it as soon as I finish an installation...

I forgot to ask one thing: Where can I get a C compiler? And is it self-explanatory to use quickly or do I have to invest a lot of time to learn how to use it?


Thanks
Feb 7 '08 #6
sakumar9
127 Expert 100+
Hi,

You can download any C compiler (search in google). You can also use microsoft C++ compiler. Once you install the compiler, you simply need to know what is the comnpiler command. For example: for microsoft compiler, the command is "cl". This is the only command that we will use.

Using compiler is very simple. Once you get the compliler installed, I'll tell you how you can use "bldapp" utility to compile all of your programs with a single command.

Regards
-- Sanjay
Feb 7 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Martin Wingelaar | last post by:
I would like to play around with BLOB and CLOB's and need the sample programs compiled by DSNTEJ71, DSNTEJ73 and DSNTEJ75. The problem is I don't have a C/C++ compiler. Could anyone send me the...
0
by: Martin | last post by:
Hi, does anybody know whether it is possible in C application (using CLI) to have multi-row parameter descriptor with column of LOB type (BLOB, CLOB, DBCLOB) whose data will be supplied at...
4
by: Nina via DBMonster.com | last post by:
Hi, I'm trying to insert a clob / blob from the local file system into a basic table. This can be quite easily accomplished in Oracle but I have not found any wquivalent way on how to do this in...
2
by: C Glenn | last post by:
What DataType should I use for a field that is BLOB SUBTYPE TEXT on the backend? I've tried String and Char. I'm getting a runtime error telling me that the SourceColumn is a Char. Thanks.
2
by: deepgun74 | last post by:
I have a blob column that is 4MB in length. I need to change it to store a 3GIG binary. 1) What is the maximum size a BLOB column can support? 2) How do i alter the size of an existing BLOB...
0
by: yoyo | last post by:
DOes anybody have a working example of how do make this work? I've tried everything I could find, Clara patch, many non-working examples using pack, baseencode, addslashes, str_replace, bin2hex,...
1
by: msc.batra | last post by:
I want to load multiple rows of BLOB and CLOB into DB2 using CLI. Which are the possible ways to do it? Any help...
1
by: G | last post by:
Hello Friends How are you? I came with a problem near you. I want to upload a image to my ftp, iam getting this below error. i have a code which is working in my local system, i have an idea...
0
by: gunjangogia | last post by:
Hello everybody, Could u please tell me the when we should use blob and when to adopt clob??? I read in the previous posts about storing files in the databse. The 2 methods mentioned were...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.