Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JDBC CLOB example
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Jatish Khanna
CLOB example
1 Answer(s)      5 years ago
Posted in : JDBC


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

Advertisement
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
array example
array example  giving input from outside for array example
example code
example code  code for displaying a list from another class on a midlet
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
NSUserDefaults Example
NSUserDefaults Example  Hi, How to use NSUserDefaults? Can anyone share me the NSUserDefaults example code? Thanks   Hi, Please check the thread NSUserDefaults Example. Thanks
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
Vitamio example
Vitamio example  Please Give me Whole Code with Manifest file for vitamio example in Android...for Playing Video in Videoview
uisearchbar example
uisearchbar example  UISearch Bar Example - How to enable UISearch bar on map view application
structure example
structure example  in the example above what do you call the names student1,student2 and student3   Post the code
Interceptors Example
Interceptors Example  Could anyone give an example of an interceptor through its usage
ibatis example
ibatis example  Which lib directory should we put the ibatis jar files as given in the example of ibatis
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
Advertisements
 

 

 

DMCA.com