aspose file tools*
The moose likes Java in General and the fly likes To get the size of the String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "To get the size of the String" Watch "To get the size of the String" New topic
Author

To get the size of the String

vikram nalagampalli
Ranch Hand

Joined: Oct 08, 2001
Posts: 91
Hi all,
Let me give a gist of my situation. I am passing a comma delimited String of SSNs (eg. 1234567890,0987654321,2345678901,3456789012)as a argument for a Stored procedure. But the problem is that, the parameter in Stored procedure can only accept a Max size of 32k. I have more probability that this String of SSN is more than 32k.
so my first question would be
1. How do i find the size of the string?
let me know what i did is right
int len = ssn.length();
int size_In_Bytes = len/1024;
2. Can anyone help me with a logic, about how to pass this string in pieces of less than 32k to the stored procdure, but at the same time making sure that SSN is passed completely.
I really appreciate an answer ASAP. Thanks in advance
Regards,
vikram
Neal Swearer
Greenhorn

Joined: Sep 13, 2002
Posts: 21
You could use a StringTokenizer to parse the SSNs out and call the stored procedure on each SSN (looping through them one at a time).
vikram nalagampalli
Ranch Hand

Joined: Oct 08, 2001
Posts: 91
Originally posted by Neal Su:
You could use a StringTokenizer to parse the SSNs out and call the stored procedure on each SSN (looping through them one at a time).

Thanks fro your reply
can you be a little more detail.
Cory Wilkerson
Ranch Hand

Joined: Aug 14, 2001
Posts: 84
Assuming you're operating under UTF-8, every digit in every social security number that I'm aware of (granted, that's us only) can be represented in eight-bit bytes, therefore, I can't imagine a social security number exceeding a 32,000 bit limitation in the database.
Here's use of a tokenizer:

Good luck,
Cory Wilkerson
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: To get the size of the String