Subject | New to IBObjects. |
---|---|
Author | delphiman |
Post date | 2001-09-06T02:24:23Z |
Thanks Lester Caine and Helen Borrie! I appreciate your time and interest.
Lester.
Is this the wrong way to go?
Is there something I am missing?
In fact I am using a modification of the Tutorial 1 model in Tutorials/Basic Tutorials/ which came with my download of IBO - to get to grips with this. Whilst and in fact the model works on the basis that one does not yet have a DataBase - and has
FDBPath := ExtractFilePath(Application.ExeName) + 'TUTORIAL.GDB';
scrMain.SQL.Insert(0, 'CREATE DATABASE ' + '''' + FDBPath + '''');
......which is not suitable for my purposes - and so I have made appropriate changes as below
FDBPath := 'c:\h\IBOTables\Family.gdb';
scrMain.SQL.Insert(0, 'CONNECT ' + '''' + FDBPath + '''');
Then you can connect. ( The second icon with the + sign )
Lovely! I can connect to (and disconnecting from) the dataBase in this manner.
But here I stop winning. Because when I run my Project I am still left with the same problem.
Which (since I am using IBO4) seems to leave me with ..
Thanks in advance for any further useful comments.
Helen
Here is some code for opening your database connection in FormCreate ...
procedure TfrmMyForm.FormCreate(Sender: TObject);
begin
with cnMain do
begin
Path := 'c:\h\IBOTables\Family.gdb';
Server := 'LOCALHOST';
\\ Protocol := cpTCP_IP; \\ Won't work in my case - unless I remark it out! What am I missing?
Username := 'SYSDBA';
Password := 'masterkey'; // NOT RECOMMENDED
if not Connected then
Connect;
{ open any datasets you want open at FormCreate}
end;
end;
Thanks for that Helen! This works perfectly.
However ...it is vastly different to the code in Tutorial 1 - which (for your convenience) is as follows
begin
// FDBPath := ExtractFilePath(Application.ExeName) + 'TUTORIAL.GDB';
FDBPath := 'c:\h\IBOTables\Family.gdb'; // My replacement for the above
// scrMain.SQL.Insert(0, 'CREATE DATABASE ' + '''' + FDBPath + '''');
scrMain.SQL.Insert(0, 'CONNECT ' + '''' + FDBPath + ''''); // My replacement for the above
scrMain.SQL.Insert(1, 'USER ' + '''' + 'SYSDBA' + '''');
scrMain.SQL.Insert(2, 'PASSWORD ' + '''' + 'masterkey' + '''' + ';');
FOriginalCaption := Caption;
UpdateFormCaption;
ShowHint := True;
with pagMain do ActivePage := FindNextPage(nil, True, True);
InitializeConnection; // Defines the Connection settings.
InitializeTransaction; // Defines the Transaction's behaviour.
InitializeConnectionBar; // Defines the behaviour of the ConnectionBar.
end;
And upon attempting to use your code I find myself getting into in all sorts of hot water.
Which is a bit of a shame as I would have liked to use Tutorial 1 (with some necessary modifications) for lecturing purposes for students whom I shall be (almost) compelling to circumvent the BDE - by using Interbase and IBObjects.
delphiman@...
Mobile: (Australia) 0407-007-159
Phone: ( Australia (02) 6041-1036)
ICQ 63345769
Lester.
>One has to ask why you are trying to do that anyway?This is my first attempt at using IBO. And I imagine that one needs one's projects to be able to connect/disconnect from one's DataBase/Tables at will. Added to which - with the use of TPageControls and several Tabs (on practically the same GUI - from a user point-of-view) I can readily move from one Table in the DataBase to the next. Having hooked each to an IB_Grid and IB_NavigationBar.
Is this the wrong way to go?
Is there something I am missing?
In fact I am using a modification of the Tutorial 1 model in Tutorials/Basic Tutorials/ which came with my download of IBO - to get to grips with this. Whilst and in fact the model works on the basis that one does not yet have a DataBase - and has
FDBPath := ExtractFilePath(Application.ExeName) + 'TUTORIAL.GDB';
scrMain.SQL.Insert(0, 'CREATE DATABASE ' + '''' + FDBPath + '''');
......which is not suitable for my purposes - and so I have made appropriate changes as below
FDBPath := 'c:\h\IBOTables\Family.gdb';
scrMain.SQL.Insert(0, 'CONNECT ' + '''' + FDBPath + '''');
>Just double click on the TIB_Connection component.Wow! Thanks for that GUI! Which I (as a total greeh-horn - having dived into Tutorial 1) had no idea it even existed.
>This will allow you to check ( and select ) DataBaseName which should
>be 'c:\h\IBOTables\Family.gdb'
>, and then username and password.This is what I expect it to be - being "SYSDBA" and "masterkey".
Then you can connect. ( The second icon with the + sign )
Lovely! I can connect to (and disconnecting from) the dataBase in this manner.
But here I stop winning. Because when I run my Project I am still left with the same problem.
Which (since I am using IBO4) seems to leave me with ..
>IBO4 has some extra bits on password to prevent them being save in a visible format.What would this be?
>This can also cause problems if you are not used to it.What would these "problems" be - and how to I overcome them?
Thanks in advance for any further useful comments.
Helen
>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).As stated above - I am working from Tutorial 1 model in Tutorials/Basic Tutorials which makes use of scripts and accordingly theTIB_Script Object.
Here is some code for opening your database connection in FormCreate ...
procedure TfrmMyForm.FormCreate(Sender: TObject);
begin
with cnMain do
begin
Path := 'c:\h\IBOTables\Family.gdb';
Server := 'LOCALHOST';
\\ Protocol := cpTCP_IP; \\ Won't work in my case - unless I remark it out! What am I missing?
Username := 'SYSDBA';
Password := 'masterkey'; // NOT RECOMMENDED
if not Connected then
Connect;
{ open any datasets you want open at FormCreate}
end;
end;
Thanks for that Helen! This works perfectly.
However ...it is vastly different to the code in Tutorial 1 - which (for your convenience) is as follows
begin
// FDBPath := ExtractFilePath(Application.ExeName) + 'TUTORIAL.GDB';
FDBPath := 'c:\h\IBOTables\Family.gdb'; // My replacement for the above
// scrMain.SQL.Insert(0, 'CREATE DATABASE ' + '''' + FDBPath + '''');
scrMain.SQL.Insert(0, 'CONNECT ' + '''' + FDBPath + ''''); // My replacement for the above
scrMain.SQL.Insert(1, 'USER ' + '''' + 'SYSDBA' + '''');
scrMain.SQL.Insert(2, 'PASSWORD ' + '''' + 'masterkey' + '''' + ';');
FOriginalCaption := Caption;
UpdateFormCaption;
ShowHint := True;
with pagMain do ActivePage := FindNextPage(nil, True, True);
InitializeConnection; // Defines the Connection settings.
InitializeTransaction; // Defines the Transaction's behaviour.
InitializeConnectionBar; // Defines the behaviour of the ConnectionBar.
end;
And upon attempting to use your code I find myself getting into in all sorts of hot water.
Which is a bit of a shame as I would have liked to use Tutorial 1 (with some necessary modifications) for lecturing purposes for students whom I shall be (almost) compelling to circumvent the BDE - by using Interbase and IBObjects.
delphiman@...
Mobile: (Australia) 0407-007-159
Phone: ( Australia (02) 6041-1036)
ICQ 63345769
----- Original Message -----
From: lester@...
To: IBObjects@yahoogroups.com
Sent: Wednesday, September 05, 2001 4:28 PM
Subject: Re: [IBO] I am new to IBObjects
> 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' + '''' + ';');
One has to ask why you are trying to do that anyway?
> 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.
Just double click on the TIB_Connection component. This will
allow you to check ( and select ) DataBaseName which should
be 'c:\h\IBOTables\Family.gdb', and then username and
password. Then you can connect. ( The second icon with the +
sign )
FormCreate would then have TIB_Connection->Open to make it
live.
Are you trying IBO3 or IBO4. IBO4 has some extra bits on
password to prevent them being save in a visible format.
This can also cause problems if you are not used to it.
--
Lester Caine
-----------------------------
L.S.Caine Electronic Services
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
[Non-text portions of this message have been removed]