Tutorials to .com

Tutorials to .com » Jsp » Database » clob field to deal with the (oracle)

clob field to deal with the (oracle)

Print View , by: iSee ,Total views: 10 ,Word Count: 183 ,Date: Sun, 19 Apr 2009 Time: 2:07 AM

Insert the first object PrepareStatement (
At this time we must set the Connection object AutoCommit for false, that is,
conn.setAutoCommit (false);
), Such written statements:
String sql = "INSERT INTO flower_news (flower_news_id, news_content, news_author) VALUES (flower_news_id_s.nextval, empty_clob (),?)";
News_content here for clob value field.

Then select news_content from folwer_news where .... out of that record just inserted.
Look at the following code:
rs = st.executeQuery (sql);
java.sql.Clob clob;
if (rs.next ()) (
clob = ((OracleResultSet) rs). getClob (1);
oracle.sql.CLOB my_clob = (oracle.sql.CLOB) clob;
OutputStream writer = my_clob.getAsciiOutputStream ();
byte [] contentStr = this.getContent (). getBytes ();
writer.write (contentStr);
writer.flush ();
writer.close ();
)
conn.commit ();// before being tabled in the end

This method which I get the string to insert

You look at it, as it is no problem in the whole process could not be submitted to you, otherwise it is not successful



Jsp And Database Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.