473,670 Members | 2,656 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.jdb c.app.DB2BLob@3 a3d1183

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 9409
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.jdb c.app.DB2BLob@3 a3d1183

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
5497
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? :confused:
1
4472
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 System.Text.UnicodeEncoding enc = new System.Text.UnicodeEncoding(); now i am using enc.GetString(value) and the value retured is one byte less if the size of the byte array is Odd. In case of files having even number of bytes, the convertion is happening correctly and...
4
49608
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 row.ToString() But it give result "System.Byte" instead of actual text...
1
4786
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) TMSFinding.Rows; System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); txtbxDetailedDescription.Text = enc.GetString(byteBlob);
1
1618
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 thru as OLE Object, and Access cannot read the field (it usually crashes Access). I can sorta pick out the data that I need (7.0, 28, 5TH PRINCIPAL MRD, 10.0 - and these occur in roughly the same place in every record returned from the db), but I am...
6
4459
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 get a "unspecified error" if I tried to add the data before converting to a byte in "deNewContextObject.Properties.Add((object)blob.pData);". public struct Blob { public IntPtr pData; public int nLength;
2
7701
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).. For ths i ve used getBlob() specified in the ResultSet API docs. Bt when i run i get an error as com.mysql.jdbc.Blob@152c4d9 The above gets printed for all the blobs with a diff in the no present @ the end.... How do u convert these...
0
3417
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 CSV-File to this table which is in ISO 8859-1 Charset. I now need to convert this binary data (which is in fact all character-data) into utf-8.
4
4242
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 code to read a blob from DB I am not having any luck, I am running this java programs using JDEVELOPER. Can anyone please give me some help? The code is as follows: ... private static byte getBytesFromBlob(Blob blob) throws Exception { ...
0
8468
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8386
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8901
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8814
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8591
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8660
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6213
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2799
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2041
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.