Hi,

I am using Cloudscape(IBM Cloudscape Version 10.1) and derbyclient.jar
provided by derby. Following are the code I am using for clean the database
connection and also PreparedStatement. 

 

    public void cleanup(Connection aoConnection,

            PreparedStatement aoPreparedStatement)  {

        try{

            if(!(aoConnection ==null || aoConnection.isClosed()))

                aoConnection.close();//Release Connection

            if(aoPreparedStatement != null)

                aoPreparedStatement.close();

        }catch(SQLException aoSQLException){

            aoSQLException.printStackTrace();

        }

    }

 

But some time this method call get hang. Can any one tell me why it is
happening?

 

I have one more problem with this database. I am updating a table using
following code.

 

//Table create script

CREATE TABLE TABLE_MEMORY (

            MEMORY_ID                 BIGINT NOT NULL GENERATED ALWAYS AS
IDENTITY,

            MEMORY                     SMALLINT,

            PRIMARY KEY (MEMORY_ID)

);

 

//JAVA Code

Connection aoConnection = getConnection();

PreparedStatement  psUpdate = aoConnection.prepareStatement("UPDATE
TABLE_MEMORY SET MEMORY=? WHERE MEMORY_ID=?");

psUpdate.setInt(counter++, 38650);

psUpdate.setInt(counter++, 15254);

int updated = psUpdate.executeUpdate();

 

If I run above code, executeUpdate method does not throw any exception and
always returns value 1. But, due to size of value I am setting (38650) is
more than size of smallint, so it does not update database.

Can any one tell me why value return by executeUpdate method is 1 even
database update is failed?

 

For any reply thanks in advance.

 

Thanks & Regards

Shambhu Kumar Sinha

 

Reply via email to