1 |
tony |
37 |
Local EmployeeDB Example |
2 |
|
|
======================== |
3 |
|
|
|
4 |
|
|
The purpose of this example is to demonstrate the use of the TIBLocalDB support component. |
5 |
|
|
This component is used with a TIBDatabase when the database is accessed using the Firebird |
6 |
|
|
Embedded Server. TIBLocalDB takes care of checking the environment and setting up FIREBIRD |
7 |
|
|
environment variables and DB parameters. It also supports initialisation of the local |
8 |
|
|
database from an archive in gbak format, plus save and restore of the local database. |
9 |
|
|
It can also run SQL scripts to upgrade the database schema when a new software version |
10 |
|
|
is released. |
11 |
|
|
|
12 |
|
|
Both GUI and Console Examples are provided. |
13 |
|
|
|
14 |
|
|
Before compiling and running the example, the Firebird embedded server must be installed: |
15 |
|
|
|
16 |
|
|
Under Linux: |
17 |
|
|
------------ |
18 |
|
|
|
19 |
|
|
Debian/Ubuntu/Mint: run "sudo apt-get install libfbembed2.5" to install the server |
20 |
|
|
|
21 |
|
|
Fedora/Red hat/Centos: su -c "yum install firebird-libfbembed" |
22 |
|
|
|
23 |
|
|
Under Windows: |
24 |
|
|
-------------- |
25 |
|
|
|
26 |
|
|
Download the Firebird Embedded Server from http://www.firebirdsql.org/en/firebird-2-5-5/ and |
27 |
|
|
extract the contents of the archive into the example directory i.e. ibx\examples\local-employeedb. |
28 |
|
|
You may replace the firebird.conf and firebird.msg files with those in the archive, |
29 |
|
|
while not replacing or renaming the readme.txt that comes with the archive. |
30 |
|
|
|
31 |
|
|
Running the application |
32 |
|
|
----------------------- |
33 |
|
|
|
34 |
|
|
The example should just compile and run. An archive of the Firebird example employee |
35 |
|
|
database is provided with the example. This will be used to create the initial database. |
36 |
|
|
It should then be automatically upgraded to "version 2" using the sql scripts provided in the |
37 |
|
|
"patches" directory. (see also the file upgrade.conf). Note that the upgrade adds |
38 |
|
|
a "photo" to employee number 2. |
39 |
|
|
|
40 |
|
|
Note that you will not be prompted for a username/password. The embedded server |
41 |
|
|
uses normal file permissions to control access. Otherwise you can edit the employee |
42 |
|
|
database as in the client/server version. |
43 |
|
|
|
44 |
|
|
The local database will be created in: |
45 |
|
|
|
46 |
|
|
Linux: $HOME/.MWA Software/employee.fdb |
47 |
|
|
Windows: <User Local Application Data Folder>\MWA Software\employee.fdb |
48 |
|
|
|
49 |
|
|
The File menu provides actions to save the current database to a gbak format archive, |
50 |
|
|
restore it again (replacing the current database) or to restore the database to its initial state. |
51 |
|
|
|
52 |
|
|
|
53 |
|
|
|
54 |
|
|
|