用jdbc 或者 hibernate
[url]http://www.weste.net/2004/11-3/12250047377.html[/url]
oracle 10g 处理clob
[url]http://blog.csdn.net/fenglibing/archive/2006/04/19/669476.aspx[/url]
好的文章
[url]http://www.herongyang.com/jdbc/Oracle-CLOB-setClob.html[/url]
解决实例:
[url]http://forum.java.sun.com/thread.jspa?threadID=349880&messageID=2778347[/url]
onvert String to CLOB and Insert into Oracle database
Jan 23, 2003 4:59 AM
Click to email this message
Hi,
I spent some time working on this, and I thought I would share it within the forum. This solution is unique to Oracle, so consider it's use carefully. It's the simplest coding I could come up with, and I have been able to insert Strings of any length using this technique with both the oci8 and thin driver when executed using Java 1.4 and Oracle 9.2. No guarantees that it will work for you. Let me know if it helps you out.
[code]
import java.sql.*;
import java.util.*;
import java.text.*;
/* -------------------------------------------------------------------
* This program demonstrates a technique for converting a large String
* to an oracle.sql.CLOB then inserting that CLOB into a database.
* I believe most of this is specific to Oracle, specifically the
* ability to create a temporary CLOB within your program.
* -------------------------------------------------------------------
*/
class TestOraCLobInsert {
public static void main (String args []) throws SQLException {
try {
DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@server:1521:sid", "uid", "pwd");
PreparedStatement ps = conn.prepareStatement("INSERT INTO CLOBTABLE VALUES (?)");
oracle.sql.CLOB newClob = oracle.sql.CLOB.createTemporary(conn, false, oracle.sql.CLOB.DURATION_CALL);
newClob.putString(1,"This string, up to 4 gigabytes will be inserted into the CLOB");
ps.setClob(1, newClob);
int rowcnt = ps.executeUpdate();
System.out.println("Successful update of "+rowcnt+" row");
ps.close();
conn.close();
}
catch (Exception e) {
System.out.println("Java Exception caught, error message="+e.getMessage());
}
}
}[/code]
[url]http://www.weste.net/2004/11-3/12250047377.html[/url]
oracle 10g 处理clob
[url]http://blog.csdn.net/fenglibing/archive/2006/04/19/669476.aspx[/url]
好的文章
[url]http://www.herongyang.com/jdbc/Oracle-CLOB-setClob.html[/url]
解决实例:
[url]http://forum.java.sun.com/thread.jspa?threadID=349880&messageID=2778347[/url]
onvert String to CLOB and Insert into Oracle database
Jan 23, 2003 4:59 AM
Click to email this message
Hi,
I spent some time working on this, and I thought I would share it within the forum. This solution is unique to Oracle, so consider it's use carefully. It's the simplest coding I could come up with, and I have been able to insert Strings of any length using this technique with both the oci8 and thin driver when executed using Java 1.4 and Oracle 9.2. No guarantees that it will work for you. Let me know if it helps you out.
[code]
import java.sql.*;
import java.util.*;
import java.text.*;
/* -------------------------------------------------------------------
* This program demonstrates a technique for converting a large String
* to an oracle.sql.CLOB then inserting that CLOB into a database.
* I believe most of this is specific to Oracle, specifically the
* ability to create a temporary CLOB within your program.
* -------------------------------------------------------------------
*/
class TestOraCLobInsert {
public static void main (String args []) throws SQLException {
try {
DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@server:1521:sid", "uid", "pwd");
PreparedStatement ps = conn.prepareStatement("INSERT INTO CLOBTABLE VALUES (?)");
oracle.sql.CLOB newClob = oracle.sql.CLOB.createTemporary(conn, false, oracle.sql.CLOB.DURATION_CALL);
newClob.putString(1,"This string, up to 4 gigabytes will be inserted into the CLOB");
ps.setClob(1, newClob);
int rowcnt = ps.executeUpdate();
System.out.println("Successful update of "+rowcnt+" row");
ps.close();
conn.close();
}
catch (Exception e) {
System.out.println("Java Exception caught, error message="+e.getMessage());
}
}
}[/code]