Subject | Re: [firebird-support] Check if an alias is defined |
---|---|
Author | Gustavo |
Post date | 2007-08-21T13:54:18Z |
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
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
----- Original Message -----
From: "eMeL" <emel@...>
To: <firebird-support@yahoogroups.com>
Sent: Tuesday, August 21, 2007 7:48 AM
Subject: Re: [firebird-support] Check if an alias is defined
>
>> 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
>
>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://www.firebirdsql.org and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>
>
>
>
>
> __________ Información de NOD32, revisión 2472 (20070821) __________
>
> Este mensaje ha sido analizado con NOD32 antivirus system
> http://www.nod32.com
>
>