Subject Re: [IBO] "Unavailable database"?
Author Helen Borrie
At 05:58 AM 27/09/2005 +0000, you wrote:
>Helen wrote: "Could you please paste the entire code for the procedure
>where you do this, including the full handler declaration with arguments?"
>
>I've included the entire event handler and object definition below.
>LoginUser is "SYSDBA" and LoginPassword is "masterkey". I've also been
>able to reproduce the error with simpler code. If I've missed
>information you need just let me know:
>
>object MainConnection: TIB_Connection
> PasswordStorage = psNotSecure
> SQLDialect = 3
> Params.Strings = (
>
> 'PATH=C:\data\customer.FDB'
> 'USER NAME=SYSDBA'
> 'PROTOCOL=TCP/IP'
> 'SQL DIALECT=3')
> Left = 36
> Top = 24
> SavedPassword = '.JuMbLe.01.432B0639073E0E4B49'
> end

Here is the problem. You need to have these strings empty. The Connection
object *may* write them in at run-time; but by having them in the DFM you
are causing them to be hard-coded.


>procedure TMainDM.DataModuleCreate(Sender: TObject);
>var
> AppPath,ServerName:String;
> IniFile:TIniFile;

and you said:

Here's the ini file:

[MAIN]
AppDatabasePath = 'C:\customers\customers.fdb'
Server = 'mainserver'



>begin
>
> With MainConnection do
> begin
> Disconnect;
> OpenIniFile;

> Database := IniFile.readString('MAIN','AppDatabasePath','');

use Path:
Path := IniFile.readString('MAIN','AppDatabasePath','');

> Server := IniFile.readString('MAIN','Server','');
> UserName := LoginUser;
> Password := LoginPassword;

include the following:
Protocol := cpTCP_IP;
PasswordStorage := psNone;

> try
> connect;
> except on E:Exception do
> begin
> MessageDlg('Unable to connect to database: '+Database+'
>'+E.Message,mtInformation,[mbOk],0);
> Application.Terminate;
> end
> end;
> end;


Helen