ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a vector of bytes that I need to store in a DB2 database and was wanting to do it with a column declared as VARCHAR () FOR BIT DATA. I can do this with no problem except when a byte representing the NULL character occurs in the vector. Anytime this occurs, the rest of the bytes are truncated. I know this is the proper behavior for if this were a string, but I was under the impression that if the column is declared as I previously mentioned, that this would support any variable length binary data including the NULL character.
I've found repeated references to people dealing with DB2 tables where the data in VARCHAR columns contained leading and embedded NULLS, so I know this is possible. Can anyone provide me with the proper INSERT statement in order to get this to work? This is the current BindParameters call I'm making for the VARCHAR () FOR BIT DATA column that's truncating after the NULL character occurs.
I've changed the field in the table to now be declared as a BLOB(30000) and I'm using the below bind parameter statement with this, however I'm still seeing the same problem. When the first byte is reached that contains 0 (NULL character), the rest of what's in ptr is ignored. ptr is declared as unsigned char ptr[30000]. For testing purposes, I've just been using a for loop and storing the value of the counter % 255 + 1 so that all the characters except for NULL are represented. Then I've gone in and just inserted a 0 value in a few places. Anyone know how I can get the full contents of ptr to be stored?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.