db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Stewart <andy.stew...@erudine.com>
Subject Help reading transaction logs
Date Thu, 03 May 2007 08:58:05 GMT
Can anybody help with how to read a transaction log written by derby in 
a jar?

I think the log consists of serialised Loggable objects and am trying to 
use the derby class files to read it back in. However when I point it at 
a transaction log (which is about 1mb big) I am not able to read any 
objects back.

The program I have got looks like:

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;

import org.apache.derby.iapi.services.io.FormatIdInputStream;

public class LogReader {

    private String logFileName;

     * @param args
    public static void main( String[] args ) throws Exception {
        LogReader logReader = new LogReader( "C:\\Documents and 

    public LogReader( String logFileName ) {
        this.logFileName = logFileName;

    public void readLogFile() throws Exception {
        File file = new File( this.logFileName );
        System.out.println( "File exists: " + file.exists() );
        InputStream fileInputStream = new FileInputStream( file );
        FormatIdInputStream formatIdInputStream = new 
        Object object = formatIdInputStream.readObject();

The output is as follows:
    File exists: true

Could anybody shed any light on what I should be doing to read these 
logs files in?


View raw message