wood burning stoves 2.0*
The moose likes JDBC and the fly likes using empty_clob() is not creating a pointer in Oracle DB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "using empty_clob() is not creating a pointer in Oracle DB" Watch "using empty_clob() is not creating a pointer in Oracle DB" New topic
Author

using empty_clob() is not creating a pointer in Oracle DB

Susan Mincey
Greenhorn

Joined: Nov 08, 2007
Posts: 13
This works if I go straight to TOAD and enter the SQL statement insert manually. But going from my app doesn't work. I am using Vignette portal on Weblogic 8.1, Oracle DB 10g, and ojdbc14.jar for the connection pool. I have read countless examples and no one else seems to have issues - maybe someone can spot my error. I am getting an exception but the exception message is NULL. I am not finding any errors in the log files. Here's the code:
// Create SQL statement
sSQL="INSERT INTO PORTALTABLE (ID, DATE, TITLE, LEADER, "
+ "PATH, BODY "
+ ") VALUES ("
+ "SEQ_ID.nextval, "
+ "TO_DATE('" + sEnteredDate + "','MM/DD/YYYY HH24:MI'), "
+ "?,?,?,empty_clob())";

// Insert the new record into DB
try
{
initCtx = new InitialContext();
ds = (DataSource)initCtx.lookup(JDBCConn);
conn = ds.getConnection();
PreparedStatement ps = null;
ps.setString(1, story.getStoryTitle());
ps.setString(2, story.getStoryLeader());
ps.setString(3, story.getPathColorClip());
ps = conn.prepareStatement(sSQL);
ps.executeUpdate() ;
plog.log("InsertStory : empty_clob inserted");
Fatih Keles
Ranch Hand

Joined: Sep 01, 2005
Posts: 182
Hi Susan,

You are setting values before initializing PreparedStatement with ps = conn.prepareStatement(sSQL).

empty_clob() is working fine within jdbc, as Oracle documentation says and as far as I have tested.

Database:


Java:


and the control select statement:



Regards,

Fatih.

Susan Mincey
Greenhorn

Joined: Nov 08, 2007
Posts: 13
Hello Fatih,
You are absolutely correct! I can't believe I did not "see" that. It just shows that sometimes we get too close and cannot see the details. I have corrected my code and of course it works just fine. I appreciate your input and I will try not to repeat that mistake.
Have a great week.
Susan
 
jQuery in Action, 2nd edition
 
subject: using empty_clob() is not creating a pointer in Oracle DB