Subject | Re: Check if an alias is defined |
---|---|
Author | gstv_m |
Post date | 2007-08-21T14:39:13Z |
I understand the security reasons, buy I only need that the client
could know if the alias exists or not. The client doesn´t need to
know the actual path of the database file in the server.
I know I can write a function that attempts to connect and if it
succeeds it returns true and if it doesn´t succed it returns false.
But it is not a good solution for my problem.
As eMeL says, my customers doesn´t have sysadmins and my application
creates databases when it needs them.
I will explain it with an example. When my application needs to open
a database, it tries to open it using a TIBDataBase component with
property DataBaseName = 'SERVER1:MyDB1' (obviously this is an alias).
If the database does not exist, then it raises an exception with the
message "I/O error for file "MyDB1" Error while trying to open file".
This can be for one of two reasons:
1. The alias MyDB1 IS NOT defined in aliases.conf in the server
2. The alias MyDB1 IS defined in aliases.conf in the server but the
database .FDB file does not exist.
After the exception, my application tries to create the file. It the
alias is defined, it works perfect, but if the alias is not defined,
it creates a file named MyDB1.FDB in the server in the path
\Windows\System32.
What I need to know, when I get the exception, is which is the reason
(the alias is not defined or the FDB file doesn´t exist).
Is there a way to do this?
Gustavo
P.S.: As in my previous message, I am posting this one directly from
the web because I sent it from my Outlook Express and it didn´t
arrive to the forum. Does anybody know which may be the problem?
could know if the alias exists or not. The client doesn´t need to
know the actual path of the database file in the server.
I know I can write a function that attempts to connect and if it
succeeds it returns true and if it doesn´t succed it returns false.
But it is not a good solution for my problem.
As eMeL says, my customers doesn´t have sysadmins and my application
creates databases when it needs them.
I will explain it with an example. When my application needs to open
a database, it tries to open it using a TIBDataBase component with
property DataBaseName = 'SERVER1:MyDB1' (obviously this is an alias).
If the database does not exist, then it raises an exception with the
message "I/O error for file "MyDB1" Error while trying to open file".
This can be for one of two reasons:
1. The alias MyDB1 IS NOT defined in aliases.conf in the server
2. The alias MyDB1 IS defined in aliases.conf in the server but the
database .FDB file does not exist.
After the exception, my application tries to create the file. It the
alias is defined, it works perfect, but if the alias is not defined,
it creates a file named MyDB1.FDB in the server in the path
\Windows\System32.
What I need to know, when I get the exception, is which is the reason
(the alias is not defined or the FDB file doesn´t exist).
Is there a way to do this?
Gustavo
P.S.: As in my previous message, I am posting this one directly from
the web because I sent it from my Outlook Express and it didn´t
arrive to the forum. Does anybody know which may be the problem?
--- In firebird-support@yahoogroups.com, eMeL <emel@...> wrote:
>
>
> > Only SYSDBA will have access to the registering function ?
>
> SYSDBA or database Owner
>
>
> > Ordinary users should not had the ability to create databases as
they wish...
>
> > ...IMHO a database is not something you will
> > create every day, an intervention by the sysadmin should not be a
> > problem...
>
>
> No user create it ;)
> My program create database for the application.
> No have sysadmin in most soho firm.
>
> eMeL
>