The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Firebird installation, easy way?

What would be the easiest way to redistribute FireBird server? At present I am using the embedded version, but now I have 2 programs that have to simultaneously access the same database and embedded is not an option anymore. I saw that embedded on Linux is redistributed with the classic server architecture and that will solve my problems, but Windows version uses the super server that exclusively locks the file.

I want to make a NSIS script that will install one version (not the latest because I can not always go with it), but it could already be installed, so I have to check that, also I would have to find out which version is already installed… this complicates the install.

I don’t want to redirect the user to download and install FireBird from firebird site because this will also add a burden more to the install process.

So, my question is which is the easiest way to ensure the right version of FireBird is installed without asking the user to make any decisions?

Any help highly appreciated.
Goran Burcevski Send private email
Friday, February 01, 2008
 
 
I have two applications that currently use the Firebird database.  Both are client server applications.  For these applications, I provide the client with a single CD (or one rather large file downloadable from my website).  On startup, the setup runs a small GUI program that privides user options for both the server setup and the workstation setup.  For a single user installation, both options are run at the workstation.

The server setup includes an empty copy of the Firebird database file that my application uses and it also includes the appropiate version of the Firebird database engine.  Once the user selects the desired install directories, my setup routine installs the Firebird database engine, copies the database file to the server and configures Firebird appropriately.  All with very little user intervention and no further downloading for the web.  Before installing the engine, it does check to see if the required version of Firebird is already installed by checking the registry.
DaveW
Saturday, February 02, 2008
 
 
Dave, my biggest concern is how to proceed if FireBird is already installed. How to check what version is installed? And if I found out that it is an older version, is it safe to install newer version? Because the user could have other programs running that require FireBird or even Interbase. What if he has some critical program and he installs now my trial and suddenly the programs that were running for years now stop running.

Other than this I don’t see other problems, except that the download would be bigger probably.
Goran Burcevski Send private email
Sunday, February 03, 2008
 
 
I understand your concern and it is a valid one.  The first thing my install program does is look for registry keys to determine if Firebird is already installed and if so, then I check the version of the server file.  If the version is one I can use (2.0 or greater) then I skip the Firebird engine install and add my applications configuration parameters to the alias.conf and security2.fdb files.  If I find an older version of Firebird, I don't attempt an automatic install and instead have the customer contact me.  I know this is less than elegant and it only works for me because I sell a rather expensive enterprise app and I routinely assist customers anyhow.

However, it is quite possible to have multiple servers existing side by side including 1.5 aand 2.0 for example.  There are some restrictions in that only one can be run as a service on Windows and the remaining must be run as applications.  And of course if you have multiple servers running, there are some extra configuration steps required such as configuring additional server instances to use a non-standard port to avoid conflicts etc.  I have done that on development machines manually but I have never taken the time to build that into an automatic installation routine.  I suppose one possibility for an automatic install whould be to always use non-standard configuration parameters so that if you were to encounter another Firebird installation you would likely avoid conflicts.

In your original post, you seemed to rule out the embedded server since it locks the database for exclusive use.  While that quite is true, it is my understanding that it is possible to have multiple applications use the same embeded server.  If you don't need client-server access this might be the way to go. It would certainly eliminate all the hassles of of multiple servers.

HTH
DaveW
Sunday, February 03, 2008
 
 
Thanks Dave for the thorough explanation.

Yes, I don’t need client/server access, but I have 2 applications and they both load the embedded server (fbembed.dll). I am not aware of any other way; I was searching on the subject quite a lot trough google and couldn’t find anything. If you have more info on how I could use the same embedded server would be great. Other way, I think I will do as you mentioned before, use nonstandard port for the server. The only stopper for me is that the firewall shows a message on the first start of the server.

Thanks again
Goran Burcevski Send private email
Sunday, February 03, 2008
 
 
> I have 2 applications and they both load the embedded
> server (fbembed.dll)

I don't understand your problem. So what if two applications both use firebird. Is there a single database file? Can't they both point to it and use it?
coder
Tuesday, February 05, 2008
 
 
Yes, they both have to access the same database. I started originally with one application and used naturally the embedded server. Then I made a second application, something as an extension to the first one. Now the first one that starts locks the file exclusively and the second can not access the file. That's my problem.
Goran Burcevski Send private email
Tuesday, February 05, 2008
 
 
Multiple applicaations can connect to the same embedded server.  However, you cannot access the same database from multiple embedded server processes at the same time.

See http://www.firebirdsql.org/manual/ufb-cs-embedded.html

So, Goran you are correct.
DaveW
Tuesday, February 05, 2008
 
 
Cite from that page:
"You can have multiple embedded servers running at the same time, and you can have multiple apps connecting to the same embedded server..."

I don't understand second part, when in says "multiple apps connecting to the same embedded server", does it mean the same instance of the embedded server? I don't believe because how can other applications connect to it? It probably means that you can load the same physical file from the disk from multiple applications, but they will all run different instances of the server, so they could not access the same file.
Goran Burcevski Send private email
Tuesday, February 05, 2008
 
 
"It probably means that you can load the same physical file from the disk from multiple applications, but they will all run different instances of the server, so they could not access the same file."

I believe you are exactly right.  It took me awhile to find that, but I now relaize you were correct in your thinking.
DaveW
Tuesday, February 05, 2008
 
 
Can't the apps share the pointer to the database?
coder
Wednesday, February 06, 2008
 
 
I am not sure would that work, sharing the handle to the database. But, it will probably add on complexity.

However, I decided on a way to go. Until now I was opening a connection on the start of the applications and closing it on the end. Another solution is to open the database, do whatever it needs to do and close the connection. But, because one of these applications accesses seldom the database I don’t think that opening and closing the database on every read/write would be a good solution. That will affect the performance of the main application that has much more data access operations, while the second uses it just to read the login info and maybe 2-3 other functions.

With a few Semaphores and Events I will synchronize the database access from these 2 applications. I will define a Semaphore with maxcount=1 that will be increased on every connection to the database. And before attempting access to the database, the process that tries to open the database will set an Event that will acknowledge the process that has opened the database that there is another process waiting for the file. This way the process that is holding the handle will release it as soon as possible and the other that is waiting will get it. This should function both ways, so whenever one process needs to read/write from/to the database, will fire this event and will wait for the semaphore.

I got this idea today while playing with sqlite. I was about to switch the database to sqlite because they allow multiple processes access to the same file. But, then I got this idea and measured the gain/loss on redoing my data access with sqlite or implementing this solution with open/close the connection to the database and I believe the second is a better way.
Goran Burcevski Send private email
Wednesday, February 06, 2008
 
 
"you can have multiple apps connecting to the same embedded server..."

I read that as you only "need" one copy of the embedded server on the machine and multiple programs can use that server for access to their specific database. To my way of thinking it has nothing to do with multiple apps accessing the same database - that AFAIK, is not allowed.
It falls in with the first part that you can also have multiple embedded servers on a machine - any number of them running at the same time.
FBNewbie
Sunday, February 24, 2008
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz