Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

preparedstatement.executeupdate

Status
Not open for further replies.

JMEHTA

Programmer
Aug 17, 2005
7
US
Hi,
I have configured my application to run locally. I am getting the following error message when i try to update one of the table through the application:

java.sql.SQLException: ORA-02290: check constraint (RMS.CHK_STAKE_LOCATION_STATUS) violated


**************************************************
java.sql.SQLException: ORA-02290: check constraint (RMS.CHK_STAKE_LOCATION_STATUS) violated

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:137)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:304)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:271)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:625)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:181)
at oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:791)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1101)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2901)

I debugged the application and found out that it was passing the correct value, so i deployed my war file on the unix box. I was able to get through and didnt get any errors on the server. Could anyone plz help me?

Thanks,
Jyotsna
 
If the error is "check constraint", I guess you have a key violation or are leaving a field null that requires a value. What is the statement you're trying to run and what is RMS.CHK_STAKE_LOCATION_STATUS?

--Dave
 
My statement is

UPDATE stake_location SET status = ?, stocktake_end_datetime = ? WHERE cycle_count = ? AND location = ?

and the check constraint is

CONSTRAINT CHK_STAKE_LOCATION_STATUS
CHECK (status in ('WS','CT','CD', 'AV', 'VP', 'AA', 'CO', 'CA', 'DE'))

The value passed to status is 'CD'

If i remove stocktake_end_datetime from the query the update statement works. The other thing that i couldnt understand was that the same war file works fine on UNIX box.

Jyotsna.
 
Hey guys whats the solution?
I tried creating a dummy table and doing an insert and it works but if i do an update on that table, it fails. This is really getting frustrating. Any help will be appreciated.
 
Maybe if you post your code we can see what's going on.

Cheers,
Dian
 
Heres my code:

private void updateHeader()
throws RswException, SQLException
{

PreparedStatement preparedstatement = getPreparedStatement("UPDATE rms.stake_location SET status = ?, stocktake_end_datetime = ? WHERE cycle_count = ? AND location = ? ");
preparedstatement.setString(1, RmsStockCountStatusConverter.convert(stockCount.getStatus()));
preparedstatement.setTimestamp(2, new Timestamp(System.currentTimeMillis()));
preparedstatement.setString(3, stockCount.getId());
preparedstatement.setString(4, stockCount.getStore().getId());
preparedstatement.executeUpdate();
}
 
Hi,

Make sure the Date and Time on Unix and time on your local m/c. Might be the reason.

Cheers
Venu
 
...and that 'RmsStockCountStatusConverter.convert(stockCount.getStatus())' returns 'CT' in UPPERCASE.

--Dave
 
I checked my code and the RmsStockCountStatusConverter.convert(stockCount.getStatus())' does returns 'CT' in uppercase. As far as my date and time settings are concerned i checked the date setting on unix and it was EDT and my local machine too has EDT.
 
Are you checking your code or actually checking the runtime values?

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top