Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

trim() ???

Posted on 2002-03-04
5
Medium Priority
?
308 Views
Last Modified: 2010-04-01
My data is store as a blob type. When i retrieve it, it becomes a object. I tried to typecast it to a string but i get errors. WHy? Is there another way for me to trim the spaces away?
0
Comment
Question by:yan_er04
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 19

Expert Comment

by:cheekycj
ID: 6838935
Isn't BLOB, Binary Large Object? so you wouln't be able to cast that to a string.


You can try retrieving it as a byte[] and then creating a string from that byte[].

have you tried trim in the query itself?
SELECT TRIM(BOTH ' ' FROM value) FROM test;
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 6841724
Did the above work?
0
 
LVL 3

Accepted Solution

by:
ibo earned 120 total points
ID: 6849617
try this snippet.. this works perfectly

                 BufferedInputStream bis = new BufferedInputStream(rsD.getBinaryStream("DATA"));
                    byte[] data = new byte[1024];
                    int byteCount;
                   
                    while ((byteCount = bis.read(data, 0, 1024)) > -1) {
                         out.write(new String(data), 0, byteCount);
                    }
                    bis.close();
0
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 9552488
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

"Accept ibo's comment as answer."
 
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Kuldeepchaturvedi
EE Cleanup Volunteer
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If something goes wrong with Exchange, your IT resources are in trouble.All Exchange server migration processes are not designed to be identical and though migrating email from on-premises Exchange mailbox to Cloud’s Office 365 is relatively simple…
Tech spooks aren't just for those who are tech savvy, it also happens to those of us running a business. Check out the top tech spooks for business owners.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question