Subject Re: [firebird-support] Firebird database portability
Author Christopher Chan
Helen Borrie wrote:
>
>
>
> First, please show consideration to others by removing tags inserted
> into the Subject header by your anti-spam tools.

I am sorry, I did not notice the tag when I replied. I have already
turned off the offending spamcop rule.

>
> At 04:18 PM 28/11/2006, you wrote:
>
> > > Is the firebird database machine independent?
> > >
> > > Or are the following files machine independent?
>
> Next thing is to get your head around what you mean by "machine
> independent". Are you talking hardware architecture, filesystem
> structure or operating system. By your comments you seem confused
> about what you mean.

All.

>
> > > firebird.msg
>
> Will get installed by the platform + architecture specific
> installer. It is not a user file and shouldn't be treated as portable.
>
> > > > security.fdb
>
> This is a system file too, but it is a database. Databases are
> portable between operating systems (and filesystems, too, more or
> less...) provided the machine architecture is the same. So you *can*
> filecopy a database from Windows on Intel-86 to Linux on Intel-86 -
> but it's not recommended as ideal.

Okay, I have a fair idea of what is possible then. I am writing an
application that will make use of firebird databases and I intend to
make it such that a single user can just install the thing, run it and
get it up and running. And make it easy for those who will use it in a
client/server setting too.

Since there is not a embedded package available that can be bundled
along with other software, I am trying to find out what is necessary to
achieve this and part of it appears to require that I provide at least
security2.fdb (typo above, i intend to use firebird 2.0) and firebird.msg.

>
> >Windows <-> Windows don't quite count as machine independent. By machine
> >independent I mean it does not matter what architecture or OS the box is
> >using, the installed programs will be able to use the files.
>
> Architecture and OS are two entirely distinct things. Don't confuse them.

Sorry, I should have used 'and' instead of 'or'.

>
> >Windows <->
> >Windows on the same architecture is not quite what I had in mind.
>
> It would be handy if you did express what you had in mind, rather
> than launch a lead canoe based on the premise that all hollow objects
> can float.
>
> >Something like cdb http://cr.yp.to/cdb.html <http://cr.yp.to/cdb.html>
> is machine independent. I
> >can copy a cdb database from a Solaris box to a FreeBSD box and it would
> >work with the local cdb programs and regardless of cpu architecture too.
>
> Well, you could if the Solaris operating system was running on the
> same machine architecture as the FreeBSD operating system. But you
> couldn't copy between e.g. Solaris Intel and Solaris Sparc....or
> between say FreeBSD running on Intel and MacOSX running on Motorola.

You can copy a cdb database between boxes that are run different cpu
architectures. You can copy from a Sparc to an Intel compatible without
any problems whatsoever. Been there done that. cdb does not suffer from
the endianness of the cpu architecture.

>
> >If I remember correctly, you could copy a mysql database from a windows
> >box to a linux box and vice versa.
>
> Intel to Intel, probably....I say that because I've yet to hear of
> anyone actually getting it to work on all points. But theoretically
> it should be possible. With Firebird it is...though *copying*
> databases at all is not a sensible thing to risk your job for.

From mysql's documentation:

" All data values are stored with the low byte first. This makes the
data machine and operating system independent. The only requirements for
binary portability are that the machine uses two's-complement signed
integers and IEEE floating-point format. These requirements are widely
used among mainstream machines. Binary compatibility might not be
applicable to embedded systems, which sometimes have peculiar processors."

http://dev.mysql.com/doc/refman/5.0/en/myisam-storage-engine.html

>
> >You can copy a mysql database from a 32-bit Linux system to a 64-bit
> >Linux system.
> >This means that the mysql database too is machine independent.
>
> If it is true (which I don't think it is, actually) it doesn't mean
> that the mysql database is machine independent. Again, I think it
> would be very unwise to stake your job on that assumption. At best
> (if it works) it means that the 64-bit operating system (whatever it
> might be) can recognise data that was stored by a 32-bit engine and
> do the right things with numerics, et al. I don't think date/time
> types are an issue with MySQL since, afair, MySQL stores dates as strings.

I will stake my job on this because it is a FACT. I have done this and I
can verify that mysql MyISAM databases are indeed machine independent in
the sense of both machine architecture and the operating system installed.

>
> Firebird gets past the issues with all of the aspects of portability,
> be it machine architecture, operating system or filesystem, by
> providing the ability to convert a database to a transportable backup
> file, which is not a database at all but a metadata schema script and
> data stored in XDR portable data format. The tool that works this
> miracle is gbak. gbak -b -t creates the transportable file; gbak -c
> recreates the database according to the operating system, filesystem
> and machine architecture that the Firebird server at its new home is
> operating on.

Yes, it is limited just as postgresql is in this aspect.

Copying mysql databases that store the data for millions of user
accounts has been standard practice for me in my former job as a mail
administrator for an outfit that manages over 30 million mailboxes.

But they both do not suit my needs. How do I embedded the firebird
client and in the case of a single user, install a local firebird
database? At the moment, this is limited to a Linux environment.