CLOB example

CLOB example

Hi everybody

can u tell me the method to use CLOB in java

the CLOB is to use with database ..........it must retrieve value with resultset and display in the JTextArea that fetched text.......

thanku
View Answers

April 21, 2010 at 12:09 PM

Hi Friend,

In MySql database,TINYTEXT, TEXT, MEDIUMTEXT and LONGTEXT can be taken as CLOB type.

Try the following code:

import java.sql.*;
import javax.swing.*;
class DisplayClobData{
public static void main(String[] args){
Clob clobFile = null;
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con =DriverManager.getConnection ("jdbc:mysql://localhost:3306/register","root";, "root");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select filedata from person1 where id ='2'");
if (rs.next()) {
clobFile = rs.getClob(1);
}
long length = clobFile.length();
String fileData = clobFile.getSubString(1, (int) length);
JFrame f=new JFrame();
JTextArea area=new JTextArea(20,60);
area.setText(fileData);
JScrollPane pane=new JScrollPane(area);
f.add(pane);
f.setVisible(true);
f.pack();

} catch (Exception e) {
System.out.println(e);
}
}
}

Thanks









Related Tutorials/Questions & Answers:
CLOB example - JDBC
CLOB example  Hi everybody can u tell me the method to use CLOB in java the CLOB is to use with database ..........it must retrieve value... can be taken as CLOB type. Try the following code: import java.sql.
Servlet Example To Insert Mysql Clob Data
Servlet Example To Insert Mysql Clob Data    This example shows how to insert CLOB data in the database. In our example, servlet InsertClobExample takes url for the CLOB data (the url
Advertisements
Servlet Example To Update Mysql Clob Data
Servlet Example To Update Mysql Clob Data    This example shows how to update CLOB data in the database. In our example, servlet InsertClobExample takes url for the CLOB data (the url
Servlet Example To Display Mysql Clob Data
Servlet Example To Display Mysql Clob Data    What is Clob?  A Clob is a Character Large Object in a Database. Clob can be very large depending on the Database up to 4 GB. 
Servlet Example To Delete Mysql Clob Data
Servlet Example To Delete Mysql Clob Data    A Clob is a Character Large Object in a Database. A large character data file upto 4 GB can be stored as CLOB type. JDBC provides
How to update clob??
How to update clob??  I have a table "articles" which contains the columns -articletitle,details,author,serial.The details column is the only column which is Clob and the serial is int.The rest are varchar2.I want to update all
How to insert clob data??
How to insert clob data??  Can any one tell me in details how to populate clob column in a table using sql??I tried simple sql statements but found... to insert more than 4000 characters.I have heard that clob fields can hold 4 gb
Problem in inserting clob data in jsp
Problem in inserting clob data in jsp  how to insert any rich text editor data (which have more than 32766 characters) in a clob type column of oracle database with jsp
upload SQL BLOB and CLOB - JDBC
upload SQL BLOB and CLOB  Please explain upload SQL BLOB and CLOB
Inserting Mysql CLOB data using Servlet
Inserting Mysql CLOB data using Servlet In this Section, we will insert "clob" data using "servlet". A CLOB is a Character Large Object in a Database table. CLOB data is used to store a block of text. It is designed
Displaying Mysql clob data using Servlet
Displaying Mysql clob data using Servlet .In this Section, we will display a clob data from a table of database using servlet. A CLOB is a Character Large Object in a Database table. CLOB data is used to store a block of text
How to save excel sheet into mysql database using blob or clob
know to go further, which one should i use BLOB or CLOB ? I have tried using CLOB and created a table like this, create table document ( name varchar(30
Deleting Mysql Clob data using servlet
Deleting  Mysql Clob data using servlet In this Section, we will discuss about how to delete a Clob data from a database table using servlet. A CLOB is a Character Large Object in a Database table. CLOB data is used to store
example
example  example on Struts framework
example
example  example on Struts framework
example
example  i need ex on struts-hibernate-spring intergration example   Struts Spring Hibernate Integration
nsentitydescription example
nsentitydescription example  nsentitydescription example
viewwillappear example
viewwillappear example  i need an example of viewwillappear
Ajax example
Ajax example   Hi, Where can I find Ajax example program? Thanks   Hi, Get it at: Ajax Tutorials First Ajax Example Ajax Login Example Thanks
example code
example code  code for displaying a list from another class on a midlet
array example
array example  giving input from outside for array example
Hibernate Example
This tutorial illustrate an example of hibernate
UIButtonTypeCustom Example
UIButtonTypeCustom Example  Hi, Can anyone provide me example of creating UIButton with UIButtonTypeCustom style? Thanks   Hi, Use following example code: UIButton *button = [UIButton buttonWithType
viewwillappear example
viewwillappear example  Hi, Can anyone share me the example of viewwillappear example in IOS? Thanks   HI, Following code can be used: - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated
ibatis example
ibatis example  Which lib directory should we put the ibatis jar files as given in the example of ibatis
Interceptors Example
Interceptors Example  Could anyone give an example of an interceptor through its usage
structure example
structure example  in the example above what do you call the names student1,student2 and student3   Post the code
uisearchbar example
uisearchbar example  UISearch Bar Example - How to enable UISearch bar on map view application
Vitamio example
Vitamio example  Please Give me Whole Code with Manifest file for vitamio example in Android...for Playing Video in Videoview
ajax example
Ajax Example Here is the list of few Ajax examples at RoseIndia.net. Ajax example Ajax example   Hi, Where can I find Ajax example... Example Ajax Login Example Thanks Ajax Tutorials  Collection of top
NSUserDefaults Example
NSUserDefaults Example  Hi, How to use NSUserDefaults? Can anyone share me the NSUserDefaults example code? Thanks (adsbygoogle... NSUserDefaults Example. Thanks (adsbygoogle = window.adsbygoogle
heightForRowAtIndexPath example
heightForRowAtIndexPath example  Hi, Give me code for heightForRowAtIndexPath example? Thanks   Hi, Please check the thread UITableView heightForRowAtIndexPath. Thanks
DAO Example
DAO Example  Dear Friends Could any one please give me any example of DAO application in struts? Thanks & Regards Rajesh
MVC Example
MVC Example  I WANT MVC EXAMPLE PROGRAM using Jsp Servlets and Jdbc with mysql of Insert,update,delete,search. please give the answer in MVC rule
NSNotificationCenter Example
NSNotificationCenter Example  Hi, can anyone help me to understand NSNotificationCenter better ..? If possible then please provide me an example or tutorial of nsnotificationcenter in objective c. Thanks
nofollow example
nofollow example  Hi, Provide me nofollow example code. Thanks   Hi, Please check the thread: How to add nofollow in website link? Thanks
standardserviceregistrybuilder example
class. But there is no code of standardserviceregistrybuilder example. Do you know... the complete code at Hibernate 4 Hello World: Example of Hello World program. Thanks
Example
UIAlertView Example
UIAlertView Example  Hi, Provide me good example of UIAlertView. What is the code of UIAlertView that I can use to display message to the user? ThanksADS_TO_REPLACE_1   Hello, You can use the following code
fgets() example
compilation. ADS_TO_REPLACE_2 Example: <?php $file = fopen("...); ?> In this example, the output will either print the line or return
Example Code
Example Code       Example Code Following are the some of example code with demos :  jQuery blur eventADS_TO_REPLACE_1 jQuery change
uialertview example iphone
uialertview example iphone  Hi, How to write uialertview example iphone code? Thanks   Hi, Please check UIAlertView Example. Thanks
java persistence example
java persistence example  java persistence example
example of function overriding in c++
example of function overriding in c++  require an example of function overriding in c
malloc in c example program
malloc in c example program  What is malloc in c? Please explain the term using an example in C program. Thanks
Dirty Checking In Hibernate Example
Dirty Checking In Hibernate Example  What is the example of Dirty Checking in Hibernate? Give me some of the example code? Thanks
Hibernate Example
This section contains a simple Hibernate 4 example using Annotation with source code. The eclipse id and Apache Tomcat is used in this example
ModuleNotFoundError: No module named 'example'
ModuleNotFoundError: No module named 'example'  Hi, My Python... 'example' How to remove the ModuleNotFoundError: No module named 'example... to install padas library. You can install example python with following command
example on struts - Struts
example on struts  i need an example on Struts, any example. Please help me out.  Hi friend, For more information,Tutorials and Examples on Struts visit to : http://www.roseindia.net/struts/ Thanks
hibernate annotations example for mappings
hibernate annotations example for mappings  Please send me example of hibernate annotations for mappings.Please send the example   Please go through the following link: Hibernate Annotations

Ads