cannot set date field to null

I am trying to set an Oracle date column to NULL. I tried using both PreparedStatement and Statement (SQL query), and it seems to hang right after the executeUpdate() call. I have autocommit enabled and the connection is open. When executing the SQL manually, the date column is correctly set to NULL. I would appreciate any insight as to what else may be causing it to hang?

Here is the code snippet:

PreparedStatement pstmt = conn.prepareStatement(

"update foo_table set date_column = ? "

+ " where foo_id = ?"

);

pstmt.setNull(1, java.sql.Types.DATE);

//pstmt.setDate(1, null);// doesn't work

pstmt.setInt(2, (Integer.valueOf(foo_id_val)).intValue() );

int rowcount = pstmt.executeUpdate();<- it hangs here

[775 byte] By [the_foobara] at [2007-11-26 18:39:03]
# 1

> pstmt.setNull(1, java.sql.Types.DATE);

Yes, do it this way

> /pstmt.setDate(1, null);// doesn't work

Your right, don't do it like that.

> pstmt.setInt(2,

> (Integer.valueOf(foo_id_val)).intValue() );

> int rowcount = pstmt.executeUpdate();<-

> it hangs here

Are you 100% sure it is at that line? I have not worked with orcale much but is there anyway to profile or track the queries that are running against it? I would try to find out the exact query that Java is running and make sure it matches what you run by hand.

zadoka at 2007-7-9 6:13:05 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2
I think I have uncovered the problem. It seems apparent that I have been issuing updates via TOAD (an IDE to Oracle), and not doing an explicit commit there. Hence, the table was locked when trying to update via jdbc. Thanks for your input!
the_foobara at 2007-7-9 6:13:05 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...