ObjectDB ObjectDB

Reading 1.x odb files in ObjectDB 2.x without upgrading

#1

Hi,

We have a problem in the backward compatibilty in our software as once we have migrated object db odb file from version 1.x to 2.x, user is unable to open the odb files in the application which is having object db 1.x installed.

Is there any way to read odb files from 1.x in object db 2.x without upgrading it ? Or user can see the content in read only mode without upgrading it ?

Thanks

edit
delete
#2

Old ObjectDB 1.x databases cannot be opened directly by ObjectDB 2.x, but can be converted to ObjectDB 2.x format and then opened.

Try running the converter, and if it works, you may add the converter (converter.jar) to your software and run it automatically to create for every ObjectDB 1.x database a copy in ObjectDB 2.x format.

If there are problems in running the converter please report.

If the converter works well with your databases, but you need help with integrating it with your software we can provide instructions.

ObjectDB Support
edit
delete
#3

Can you please provide the instrucitons how to integrate the converter.jar in the software.

Currently, I am using the following code

    String commandLine = "java -jar converter.jar " + oldOdbFileName + " " + newOdbFileName;

    Process proc = Runtime.getRuntime().exec( commandLine );

I am not sure whether the above process is the right one or not ?

edit
delete
#4

It could be easier with no additional process:

com.objectdb.Converter.main(new String[] {oldOdbFileName, newOdbFileName});
ObjectDB Support
edit
delete
#5

Sometimes i have observed that coverter is not giving the expected result.

Once i found that objectdb 1.x was having one row but after converting to objectdb 2.x, no row was present the odb file.  But when i deleted new old file and tried again using converter, it worked fine.

Now, i was trying to convert one odb file. The new odb file is corrupted. I am attaching both new and old odb file. And i am doing conversion inside the jaa applications by using the following code

com.objectdb.Converter.main(new String[] {oldOdbFileName, newOdbFileName});

When i used through command prompt, it worked fine. Its difficult for us to release out software, if this type of problem still exist.  Please let me know what is the issue and how do i solve now.

edit
delete
#6

I just realized that conversion is working fine when i am doing through the follwoing code

String commandLine = "java -jar converter.jar " + oldOdbFileName + " " + newOdbFileName;
Process proc = Runtime.getRuntime().exec( commandLine );

Gobbler outGobbler = new Gobbler(proc.getInputStream());
        Gobbler errGobbler = new Gobbler(proc.getErrorStream());
        Thread outThread = new Thread(outGobbler);
        Thread errThread = new Thread(errGobbler);
        outThread.start();
        errThread.start();

        outThread.join();
        errThread.join();

       
        proc.waitFor();

static class Gobbler implements Runnable
    {
        private BufferedReader reader;
        private List<String>   output;

        public Gobbler( InputStream inputStream )
        {
            this.reader = new BufferedReader( new InputStreamReader( inputStream ) );
        }

        public void run()
        {
            String line;
            this.output = new ArrayList<String>();
            try
            {
                while( ( line = this.reader.readLine() ) != null )
                {
                    this.output.add( line + "\n" );
                }
                this.reader.close();
            }
            catch( IOException e )
            {
                // TODO
                System.err.println( "ERROR: " + e.getMessage() );
            }
        }

        public List<String> getOuput()
        {
            return this.output;
        }
    }

But when i do the coversion using the following code

com.objectdb.Converter.main(new String[] {oldOdbFileName, newOdbFileName});

I always gets corrupted database.  I am doing coversion of 6 odbfile files one by one. This is may help you to diagnose the problem.

edit
delete
#7

Actually the method of #4 (of direct call to the converter) has not been tested. I thought that it should work but your report indicates that the converter is not designed for multiple invocations - sorry.

If you are interested it may possible to improve the Converter but that could not be done immediately.

The immediate solution will be to run a separate process.

ObjectDB Support
edit
delete

Reply

To post on this website please sign in.