473,654 Members | 3,022 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do i get clob data using java and assign to a variable

37 New Member
Hiiiiii


i am having a table in oracle. in that table one of the column is to store clob data. and in that clob column, the data is inserted like the following using separators

kanthi~is a good girl~she is very pretty~,^mamy~i s a good girl~



wat i need is , i need to get them separately
like name=kanthi
description=is a good girl


can anyone help me with the code
it is urgent
thanks in advance
Mar 12 '07 #1
38 24957
r035198x
13,262 MVP
Hiiiiii


i am having a table in oracle. in that table one of the column is to store clob data. and in that clob column, the data is inserted like the following using separators

kanthi~is a good girl~she is very pretty~,^mamy~i s a good girl~



wat i need is , i need to get them separately
like name=kanthi
description=is a good girl


can anyone help me with the code
it is urgent
thanks in advance
Split the String up using the split method.
Expand|Select|Wrap|Line Numbers
  1.  String s = 
  2. "kanthi~is a good girl~she is very pretty~,^mamy~is a good girl~";
  3. String[] words = s.split("~");
  4.  
Mar 12 '07 #2
kanthi84
37 New Member
Thanks For The Reply.

But Wat I Was Asking Is
How To Get The Clob Data Using Java AND STORE IT IN A STRING VARIABLE AND THEN GET THE WORDS SEPARATED
Can U Help Me With The Code
Mar 12 '07 #3
r035198x
13,262 MVP
Thanks For The Reply.

But Wat I Was Asking Is
How To Get The Clob Data Using Java AND STORE IT IN A STRING VARIABLE AND THEN GET THE WORDS SEPARATED
Can U Help Me With The Code
Did you try the getObject method of resultset and calling the toString method on the returned object?
Mar 12 '07 #4
kanthi84
37 New Member
Thanks For The Reply

Sorry, I Didnt Try Those. Can U Give Me A Sample Code
Thanks In Advance
Mar 12 '07 #5
r035198x
13,262 MVP
Thanks For The Reply

Sorry, I Didnt Try Those. Can U Give Me A Sample Code
Thanks In Advance
Well it really depens on what you have so far.
If you have a resultset rs that you have retrieved the table data into, then you can simply do

Expand|Select|Wrap|Line Numbers
  1.  Object o = rs.getObject("columnName"); 
passing the name og the column that contains the clob data. Then

Expand|Select|Wrap|Line Numbers
  1.  String s = o.toString(); 
Mar 12 '07 #6
kanthi84
37 New Member
thanks for the reply.. i will try it out and will inform u
Mar 12 '07 #7
kanthi84
37 New Member
SORRY TO SAY THAT I AM NOT GETTING THE REQUIRED OUTPUT
I AM GETTING THE FOLLOWING

oracle.sql.CLOB @48af

PLEASE PROVIDE ME WITH THE SOLUTION
Mar 12 '07 #8
r035198x
13,262 MVP
SORRY TO SAY THAT I AM NOT GETTING THE REQUIRED OUTPUT
I AM GETTING THE FOLLOWING

oracle.sql.CLOB @48af

PLEASE PROVIDE ME WITH THE SOLUTION
There is also java.sql.Clob interface I'm sure.

Check the ResultSet API and see if there is no getClob method
Mar 12 '07 #9
r035198x
13,262 MVP
There is also java.sql.Clob interface I'm sure.

Check the ResultSet API and see if there is no getClob method


Just confirmed it. So you can retrieve it as a clob with

Clob myClob = rs.getClob("col umnName");
then you can use the method getSubString(lo ng pos, int length) to get the string from it which returns a String
Mar 12 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
11487
by: Chris | last post by:
I use websphere connection pooling and had a failure attempting a CLOB.createTemporary. tempClob = CLOB.createTemporary(conn, true, CLOB.DURATION_SESSION); Here's an excerpt of the exception and stack-trace. java.lang.ClassCastException: com.ibm.ejs.cm.proxy.OracleConnectionProxy at oracle.jdbc.driver.OracleConnection.physicalConnectionWithin
0
3326
by: thefirstwml | last post by:
Hi, I cannot view CLOB fields when I use the Sample Contents in the Control Center. When I insert values, I see the CLOB fields as blank. A fellow developer is using the exact same DB2 UDB version on the desktop, connecting to the DB2 UDB 8.1 on AIX, and he can see the sample contents just fine. When I use Java to query the data, the data prints out just fine (using a Clob data type and BufferedReader). What settings do I need to...
1
2478
by: sea | last post by:
When I use app driver, I get error reading clob data from the database. Below is how this is done using odbc, the same code does not work with jdbc app driver though, any suggestions on how to read clob data from database and convert to string? try { InputStream r = rs.getAsciiStream(colNum); String s = ""; for (int c=r.read(); c!=-1;
1
5946
by: Srinadh | last post by:
Hi all, We have files with about 20 to 30 fields per row. We are trying to update such files with about 60 rows as contiguous data in a CLOB field. It passes through. But when we try updating files with about 60 to 200 rows, we get the
8
4997
by: gimme_this_gimme_that | last post by:
I have the following Java code : package com.rhi.bb.udf.utils; import java.sql.Clob; import java.sql.SQLException; import java.util.regex.Pattern; import java.util.regex.Matcher;
2
10293
by: Jason | last post by:
Hi, I was wondering if anyone could advise me on this. Right now I am setting up a DB2 UDB V8.2.3 database with UTF8 character set, which will work with a J2EE application running on WebSphere Application Server. I have two questions: 1. How many characters, such as Chinese, Japanese, can a CHAR(128) or
3
4583
by: egarobar | last post by:
I am using Access 2003 (on WinXP) to read from an Oracle db, where there is a table with a CLOB which is a variable-size text field. In the 'linked table' which is created in the Tables panel of Access, the CLOB becomes a Memo field. I need to create a report that displays the data from this CLOB in the correct format. The data in the CLOB contains any number of chr(13), i.e. Carriage Returns, without LF, to separate lines of data that are...
0
2792
by: srinivasaraonagisetty | last post by:
hi, I am faceing one problem, while inserting the data in db2 using clob. actually i am writing this type code: public class DBParam { private InputStream inputstream; private static int htmLength=0; public DBParam(String c,String k) //k has the data of html { this.inputStream=getStreams(k); this.htmlLength=k.length();
3
7360
by: db2admin | last post by:
Hello all, I have table with CLOB column length of ~65K. application is searching from this table by CLOB and i can not create index on it. I know IBM recommends using DB2 Net Search Extender or DB2 UDB Text Information Extender for searching CLOBS but what are the other solutions out there. can i use some other data type and create index on it ? any ideas ?
0
8375
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
8707
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
8482
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
8593
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
6161
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...
0
4149
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2714
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
1
1916
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.