Subject Re: [IBO] I am new to IBObjects
Author Helen Borrie
Scripts are not used for connecting to the database - they are run from an active connection to the server and are used for creating metadata (DDL scripts) or performing batch operations on a database (DML scripts).

Here is some code for opening your database connection in FormCreate (assuming the database objects are on your form and not in a data module) with your hard-coded parameters:

procedure TfrmMyForm.FormCreate(Sender: TObject);
begin
with cnMain do
begin
Path := 'c:\h\IBOTables\Family.gdb';
Server := 'LOCALHOST';
Protocol := cpTCP_IP;
Username := 'SYSDBA';
Password := 'masterkey'; // NOT RECOMMENDED
if not Connected then
Connect;
{ open any datasets you want open at FormCreate}
end;
end;

Note also that if you set LoginPrompt true you will avoid hard-coding the connection parameters. You can also use one of the PasswordStorage set members at design time to determine the level of security for storing passwords, from psNone (worst: stores the password lightly encrypted in the DFM file) though a couple of levels of Registry storage, to psSecure, which stores nothing and requires username and password entry every time.

/helen

At 03:08 PM 05-09-01 +1000, you wrote:
>Hi all!
>
>Using SYSDBA and "masterkey" I am able to successfully access c:/h/IBOTables/Family.gdb via the Interbase InteractiveSQL. Interface
>
>Can anyone please throw some light upon why I nevertheless get a "Your user name and password are not defined. Ask your administrator ....etc.etc" exception when I use the following procedure in FormCreate as follows?
>
>procedure TfrmMyForm.FormCreate(Sender: TObject);
>begin
> FDBPath := 'c:\h\IBOTables\Family.gdb';
> scrMain.SQL.Insert(0, 'CONNECT ' + '''' + FDBPath + '''');
> scrMain.SQL.Insert(1, 'USER ' + '''' + 'SYSDBA' + '''');
> scrMain.SQL.Insert(2, 'PASSWORD ' + '''' + 'masterkey' + '''' + ';');
>
>For what it's worth the form has the following IBObjects:
>
>A TIB_Connection with the following Properties
> Name set to cnMain
> AliasName set to IBLocal
> PassWord set to masterkey
> SysDBA set to SYSDBA
> User Name set to SYSDBA
> DataBaseName set to Family.
>
>A TIB_Connection Bar with the following Properties
> Name set to barConnectionBar
> IB-Connection set to cnMain
>
>TIB_Script with the following Properties
> IB-Connection set to cnMain
> Name set to scrMain
> SQL String List Editor is clear.
>
>TIB_Transaction with the following Properties
> Announced Focus set to True
> IB-Connection set to cnMain
> Name set to tnMain
>
>Thanks in advance.
>
>delphiman@...
>Mobile: (Australia) 0407-007-159
>Phone: ( Australia (02) 6041-1036)
>ICQ 63345769
>
>
>
>
>
>[Non-text portions of this message have been removed]
>
>
>
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________