473,513 Members | 2,684 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to convert bytes[] to blob

1 New Member
hi,
I have a password field that I need to store in a db2 database. I created a blob field in my table, and I am trying to update it with the following java

dal.getPrepared().setBytes(15, pwBytes);

The code executes without errors, but when I look at the field, it has this in in

COM.ibm.db2.jdbc.app.DB2BLob@3a3d1183

I am trying to figure out how to convert a bytes[] field into a blob, but I am coming up dry.

So I have 2 questions:
1. Is Blob the correct field type to story bytes[] data?
2. What java type should be used to pass bytes[] data to db2?

Thanks for your help
Mar 6 '08 #1
1 9366
sakumar9
127 Recognized Expert New Member
hi,
I have a password field that I need to store in a db2 database. I created a blob field in my table, and I am trying to update it with the following java

dal.getPrepared().setBytes(15, pwBytes);

The code executes without errors, but when I look at the field, it has this in in

COM.ibm.db2.jdbc.app.DB2BLob@3a3d1183

I am trying to figure out how to convert a bytes[] field into a blob, but I am coming up dry.

So I have 2 questions:
1. Is Blob the correct field type to story bytes[] data?
2. What java type should be used to pass bytes[] data to db2?

Thanks for your help

1. Blob is the correct field to store bytes[] data.
2. Use Blob type to pass bytes data to db2.

Check this sample: sqllib/samples/java/jdbc/dtlob.java

Regards
-- Sanjay
Mar 10 '08 #2

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

Similar topics

0
5485
by: stprsbk | last post by:
I have a field in a table that is defined as a BLOB. I need to convert the data in the field from a BLOB to JPG format. Is this possible? Can someone provide some information on how to do this?...
1
4442
by: Swarup | last post by:
I am reading a file (txt, xml, gif, ico, bmp etc) byte by byte and filling it into a byte arry. Now i have to convert it into a string to store it in the database. I use...
4
49530
by: Serge Klokov | last post by:
Hello! I have a Oracle table with a BLOB field. Each field is actually a simple text file of several lines. How to get this BLOB fields in readable format? I tryied something like...
1
4715
by: Devhead | last post by:
i have a blob field in an sql server column field that stores html text. how do i convert it so that it is readable in a text control. right now when i convert using: byte byteBlob = (byte)...
1
1608
by: supercooper | last post by:
I have this string that is being returned from a query on a DBISAM database. The field must be some sort of blob, and when I connect to the database thru ODBC in MS Access, the field type comes...
6
4450
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using VS2005, .net 2 and C# for windows application. I need to convert a IntPtr to a byte to be able to add a meetingBlob data to the meeting class object in Active Directory schema. I...
2
7679
by: jith87 | last post by:
I m using JSP @ front end and MySql db @ back end and the connectivity thru JDBC. While retrieving a blob(MySql format) from the db back to JSP i need to convert ths to blob(Java comaptible format).....
0
3410
by: Michael Postmann | last post by:
Hello! I have Oracle 10g using AL32UTF8 as internal charset. I have a documents table where uploaded files (I'm using modplsql web-gateway (release 8i)) are stored in a blob-column. I upload a...
4
4210
by: skunapareddy | last post by:
I am needing to read a blob from database and pass it to another java program. I researched internet and found a program that reads a file on the client pc and gives bytes, but when I modified the...
0
7257
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7157
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
7379
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,...
0
7535
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7521
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
3232
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
455
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.