投稿者:: Gelein van de Voorde
概要: Implementation of Server Side Database Aliases in IBConsole
Using Aliases in IBConsole.
As far as I can remember IBConsole has always been using the term “Alias name” for a database as reference to display in the Servers tree of the main window of IBConsole.
The big change came when InterBase in version 7.5 introduced the “Server Side Database Alias”. The purpose of this alias is to archieve a higher flexibility. Applications can refer to the alias when making a connection without knowing the exact name (full path) of the database. The security database of InterBase was extended with a new table named “DB_ALIAS” holding the names of the aliases and their full pathnames. In the Operations Guide (OpGuide.pdf) also the term “Alias name” is being used to refer to the “Server Side Database Alias”, which lead to a lot of confusions, the more because the IBConsole part of the Operations Guide was not updated to reflect the changes. The purpose of this document is to describe the relationship between the “Alias name” in IBConsole and the “Server Side Database Alias”.
IBConsole is an all-in-one database tool. It combines database administration, interactive SQL and communications testing capabilities in one easy to use application. The purpose of IBConsole is to provide the user a graphical interface to perform all administration and maintenance tasks without knowing anything about the commandline utilities of InterBase or the SQL-statements to perform this tasks. IBConsole is like a management console, but it is more then that. For the purpose of this document only the management part is relevant. Like most management consoles IBConsole has a left pane holding a tree with servers and there underlying components and a right pane where actions and properties are displayed. The figure below shows an overview of IBConsole with a connection made to one server.
In this figure the databases are displayed with theire “Alias name”. In the right pane one of the possible actions is to display the “Server Side Database Aliases”. This action is only available when logged on to the server as SYSDBA, because he is the only one who can maintain the “Server Side Database Aliases”. The figure below shows the list of these aliases when the action is executed.
As you might see this list shows the same names only in a different order. This overview also has the possibility to remove unwanted or obsolete aliases. As soon as an alias is selected the “Delete” button becomes available. Pressing the “Delete” button will remove the selected alias from the list and the “OK” button becomes also availible. After pressing the “OK” button all deleted aliases will be removed permantly from the security database. Pressing the “Cancel” button leaves the security database unaltered and closes the window.
IBConsole has several options to add or modify a “Server Side Database Alias”. There is however one condition that must be met: the SYSDBA password must been known. The implementation of the administration of “Server Side Database Aliases” has been made step by step. This document is based on the latest beta release of IBConsole (22.214.171.1249) available from http://www.gvsnet.nl/ibconsole.
Be aware that the captions of some checkboxes in the figures below have a different text and sometimes also a different meaning in the latest official release (126.96.36.1996) that ships with SP2 of InterBase 2007. They might even sometimes be missing (invisible).
Supplying the SYSDBA password.
IBConsole keeps track of the SYSDBA password for each server registered in the console. Whenever the SYSDBA password is not available when the user request to add or modify a “Server Side Database Alias”, IBConsole will prompt for it. Cancelling this prompt will not abort the operation in progress but no changes to the security database will be made.
Adding an existing database.
When adding an existing database to the servers tree IBConsole displayes the dialog below. If the version of the server is 7.5 or above a checkbox “Save Alias Information” is visible and will be default checked. The Alias Name will be derived from the filename specified using the filename part only. The user can override the suggested Alias name. If the user leaves the checkbox checked IBConsole will try to add the Alias to the security database, prompting for the SYSDBA password if necessary.
Creating a database.
If you create a new database IBConsole displays the dialog below.
If you leave the “Save Alias Information” checkbox checked IBConsole will try to add the specified alias to the security database.
Modifying or adding an alias.
For an already registered database you can add or modify a “Server Side Database” by using the database properties dialog. Select the database in the server tree and execute the action “Properties”. No connection to the database is required.
Change the Alias Name if necessary (only if you want to change that) and check the “Save Alias Information” checkbox and press OK. That is all what is needed to add or modify the “Server Side Database Alias” for an already registered database.
Connecting to a database using the Alias.
IBConsole offers you the oppertunity to connect in IBConsole using the alias by checking the “Use Alias for DB Connect” checkbox (see the figures above). The main reason for this option is that the versions 7.5.x of InterBase does not allow mixed connections, all clients have to connect using the alias or not. This restriction is removed in InterBase 2007 (8.0). It should be noticed that using the “Server Side Database Aliases” is not available in Desktop Editions. Although the documentation of InterBase do not mention this restriction, the use of “Server Side Database Aliases” works only with Server Editions.
The “Use Alias for DB Connect” checkboxes are not available in the latest official release (188.8.131.526) that ships with SP2 of InterBase 2007.
As developper you have always to deal with certain questions. Do I prompt every time for a password or can I find away to avoid this to make it more user friendly? I decided to take the risk to go for the second. IBConsole now keeps track of the SYSDBA password for each server involved. To eliminate security risks the settings of IBConsole (IBConsole.xml) are no longer saved in the directory where the IBConsole.exe resist, but somewhere in the ApplicationData of the user. This practice was already introduced on Windows Vista and (Linux) Ubuntu requires the same approach. If you start a version of IBConsole of 184.108.40.2066 (or above) your settings will be moved to or saved in the User ApplicationData. The exact location depends on the Operating System and the instance of InterBase you are using.
On MS Windows you find the settings under ApplicationData in a subfolder \Borland\InterBase\”Instance”, where “instance” stands for the instance of InterBase (default: gds_db). If there is no server present on your computer - or the IBConsole.exe you are using is stored somewhere else – the settingsfile is stored in \Borland\InterBase.
On Linux systems the “HOME” directory is used. Within this directory you find a (hidden) folder /.borland/interbase. Although IBConsole tries to distinguish between multiple instances the chance that this really works is very smal. You probably get only one settingsfile in /.borland/interbase.
21 february 2008,
Gelein van de Voorde,