Oracle's clob field is generally not available in the database system. Its reading methods are also somewhat different. Below is a readCodeIt includes the JavaBean database connection and clob implementation methods:
1 dB. Java:
Package user;
Import java. SQL .*;
Public class dB {
Public dB (){
}
Connection conn = NULL;
// Set your database username and password:
String user = "system ";
String Password = "manager ";
Public java. SQL. Connection getconn (){
Try {
Class. forname ("oracle. JDBC. Driver. oracledriver"). newinstance ();
String url = "JDBC: oracle: thin: @ Sun: 1521: Oil ";
Conn = drivermanager. getconnection (URL, user, password );
}
Catch (exception e ){
E. printstacktrace ();
}
Return this. Conn;
}
}
2 part of clob. JSP code:
connection conn = user. getconn ();
statement stmt = Conn. createstatement (resultset. type_scroll_sensitive, resultset. concur_updatable);
string SQL = "select * From clobtest where clob_id = '" + clob_id + "' and dates = '" + dates + "'";
resultset rs1_stmt.exe cutequery (SQL);
while (RS. next ()
{< br> oracle. SQL. clob = (Oracle. SQL. clob) rs. getclob ("fieldone");
If (! (Null = clob | clob. length () = 0)
{< br> clobtext = clob. getsubstring (long) 1, (INT) clob. length ();
xvalue = clobtext;
}
oracle. SQL. clob clob1 = (Oracle. SQL. clob) Rs. getclob ("fieldtwo");
If (! (Null = clob1 | clob1.length () = 0)
{< br> clobtext1 = clob1.getsubstring (long) 1, (INT) clob1.length ());
yvalue = clobtext1;
}< BR >}