Saving a serialized object into a derby database

E

Enter The

Hello,

I'm trying to save some objects into a derby database. The table is
defined with

sql = "CREATE TABLE simpleMarketPrices(" +
"marketId INT NOT NULL PRIMARY KEY, " +
"content BLOB , " +
"cachedate TIMESTAMP)";

My save function is

public synchronized void saveObject(String sql,Object obj){

byte[] b;
try{
PreparedStatement ps = conn.prepareStatement(sql);

ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oout = new ObjectOutputStream(baos);
oout.writeObject(obj);
oout.close();

b = baos.toByteArray();

ps.setBytes(1, b);
ps.execute();
//ps.setInt(2, ++count);

System.out.println("Data Saved");
}catch(Exception e){
System.err.println("Caught an error while trying to save
object, sql is " + sql);
System.err.println("Error: " + e.getLocalizedMessage());;
System.exit(0);
}
}

I am calling the above function with:

sql = "INSERT INTO simpleMarketPrices(marketId,content,cachedate)
VALUES(" + marketId + ",?,'" + now + "')";

saveObject(sql,this);

where this is an object that I've created.

However, I keep on getting the following error:

Caught an error while trying to save object, sql is INSERT INTO
simpleMarketPrices(marketId,content,cachedate)
VALUES(20643274,?,'2007-10-18 15:59:26.006')
Error: Page Page(2,Container(0, 896)) could not be written to disk,
please check if disk is full.

My disk is not full, so that isn't the problem. And I'm using the SUN
JRE, so it isn't the IBM JRE that's causing this.

Does anyone know how I can resolve this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top