472,981 Members | 1,241 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

what is the correct DB2 data type to store an encrypted string

I encrypted a string within a Java application. I need to store that
encrypted string in a given field in the DB2 database. Currently the
datatype for that field is char(10). I am getting a SQLCODE: -302
error, which means incompatible data types.

The encrypted strings are longer than 10 characters. I am not sure if
BLOB data type needs to be used or if I can increase my existing field
to char(30).

Thanks,
Yasaswi

Nov 30 '06 #1
3 3523
The error you're getting is that the destination field is too small for
what you want to store, not that the datatype is incompatible. Just
increase the length from 10.

ipy2006 wrote:
I encrypted a string within a Java application. I need to store that
encrypted string in a given field in the DB2 database. Currently the
datatype for that field is char(10). I am getting a SQLCODE: -302
error, which means incompatible data types.

The encrypted strings are longer than 10 characters. I am not sure if
BLOB data type needs to be used or if I can increase my existing field
to char(30).

Thanks,
Yasaswi
Nov 30 '06 #2
jefftyzzer wrote:
The error you're getting is that the destination field is too small for
what you want to store, not that the datatype is incompatible. Just
increase the length from 10.

ipy2006 wrote:
>I encrypted a string within a Java application. I need to store that
encrypted string in a given field in the DB2 database. Currently the
datatype for that field is char(10). I am getting a SQLCODE: -302
error, which means incompatible data types.

The encrypted strings are longer than 10 characters. I am not sure if
BLOB data type needs to be used or if I can increase my existing field
to char(30).
You probably should switch to VARCHAR though. There is no telling how
your decryption will react when you get blank padding.
Also I recommend you use FOR BIT DATA:
E.g. VARCHAR(100) FOR BIT DATA

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

WAIUG Conference
http://www.iiug.org/waiug/present/Fo...Forum2006.html
Nov 30 '06 #3
Hi Yasaswi,

ipy2006 wrote:
I encrypted a string within a Java application. I need to store that
encrypted string in a given field in the DB2 database. Currently the
datatype for that field is char(10). I am getting a SQLCODE: -302
error, which means incompatible data types.

The encrypted strings are longer than 10 characters. I am not sure if
BLOB data type needs to be used or if I can increase my existing field
to char(30).
You can increase the fieldsize, no problem here.

But what's much more important, is, that you should change the field to char
for bit data!
If you don't, and your DB uses (or will use later) a different codepage than
some client, DB2 will perform automatic codepage conversion of the string,
which will make the string undecryptable for the client.

HTH,

Joachim Banzhaf

Dec 1 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Brian P. Hammer | last post by:
All - I have an app that saves data to a xml file via a dataset. Our company stores some data in various xml files that is now considered a risk under its security policy. What's the best way to...
3
by: Todd Gruben | last post by:
I am trying to send some encrypted data from a php application to be decoded in a .Net application. Both apps encode/decode a given string but generate different encrypted results. Anyone have...
2
by: Benoit Martin | last post by:
I'm developping a windows app that will be sold to different clients. The app connects to a Database located on my server. That app is installed on multiple machines for each client. Each client...
9
by: Suresh | last post by:
Hi All I have one column which has data type of varchar only. in this column i want to store some secured data (I want to store this data by encrpting using db2 encryption function).But along...
8
MMcCarthy
by: MMcCarthy | last post by:
Type MemSize RetVal of VarType() Declaration Char Conversion Boolean 2b vbBoolean(11) CBool() Byte 1b vbByte(17) ...
9
by: seep | last post by:
hi i m finding following error on the code that i wants to use to get all record from table via store procedure with paging. the error is : Input string was not in a correct...
3
by: ist | last post by:
Hi, I am trying to get (and transfer over ASP.NET) some encrypted data from some MySQL fields. Since the data contains many unicode characters, I tried to get the data as a series of ASCII...
5
by: akshaycjoshi | last post by:
Ok ! I am reading the book Pro ADO.net. The author says that the <exename>.config files can store the connection string for security purposes. Later he says that still the connection string...
6
by: priyajohal | last post by:
#include<fstream.h> #include<process.h> #include<stdlib.h> #include<conio.h> #include<string.h> #include<dos.h> #include<ctype.h> #include<stdio.h> void setup() void help();
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.