Solved

linking Database with Multi-user design

Posted on 2002-04-25
10
193 Views
Last Modified: 2010-04-04
Please help me accessing this one. where can i find the
"DATABASE.GDB" file? and how can i put password on it?
what do "IB_SERVER" mean and what is this? can anybody teach me how to make a ".GDB" FILE and to add new tables inside

var

MyList: TStringList;
begin
MyList := TStringList.Create;
try
with MyList do
begin
Add('SERVER NAME=IB_SERVER:/PATH/DATABASE.GDB');
Add('USER NAME=MYNAME');
end;
Session1.AddAlias('NewIBAlias', 'INTRBASE', MyList);
finally
MyList.Free;
end;
end;
0
Comment
Question by:girlswants_me
  • 3
  • 2
  • 2
  • +2
10 Comments
 

Author Comment

by:girlswants_me
ID: 6967885
help me please
0
 
LVL 8

Expert Comment

by:TOndrej
ID: 6967914
Interbase is a database server: http://www.borland.com/interbase/
You can create databases, tables, data in it using SQL.
0
 

Author Comment

by:girlswants_me
ID: 6967923
my question in how to use that "code" and how to access the GDB file
0
 
LVL 8

Expert Comment

by:TOndrej
ID: 6967959
You were asking "where you can find database.gdb file" and "how to put password on it" so I assume you have no idea what you want and gave you the link to interbase site where you can start learning.

If you have Interbase installed then read the documentation which tells you precisely how to login to the server, create databases, attach to them and work with tables.

The code you posted seems to use BDE TSession component to create an alias using BDE INTRBASE driver.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6967965
listening . . . firsttime :-)
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 27

Expert Comment

by:kretzschmar
ID: 6967967
hi tondrej ;-)
0
 
LVL 4

Expert Comment

by:nestorua
ID: 6969384
HI,
First of all, I assume you have ibserver (ibguard)
(Interbase Server and/or Interbase Gardian) running on your
computer.
Then you can go to f.e. SQL Explorer and open IBLocal (alias)
using User=SYSDBA and password=masterkey.
IBLocal must point to the file
\..borland shared\data\employee.gdb.
Then you open this db and can work on it.
If you want to create your own ".gdb" file you must launch the
WISQL (Interbase windows ISQL) and using SQL language create
your database (create database, create table and so on).
That's all.
Sincerely,
Nestorua.
0
 
LVL 6

Accepted Solution

by:
Stuart_Johnson earned 100 total points
ID: 6970595
Here's the code I use to create an Interbase database from within Delphi.  It also allows you to add an alias to the BDE as well.

procedure TCreateIBDataseForm.CreateDatabase;
var
  Params: TStringList;
begin
  try
    IBDatabase.DatabaseName := IBDBPathEdit.Text;
    IBDatabase.Params.Clear;
    IBDatabase.Params.Add('USER "' + UsernameEdit.Text + '"');
    IBDatabase.Params.Add('PASSWORD "' + PasswordEdit.Text + '"');
    IBDatabase.Params.Add('PAGE_SIZE ' + PageSizeEdit.Text);
    IBDatabase.CreateDatabase;
    if CreateNewAliasRadio.Checked then
      begin
       Params := TStringList.Create;
        try
          try
            Params.Add('SERVER NAME=' + IBDBPathEdit.Text);
            Params.Add('USER NAME='+ UsernameEdit.Text);
            Session.AddAlias(AliasNameEdit.Text, 'INTRBASE', Params);
            Session.SaveConfigFile;
          except
            on E: Exception do
              MessageDlg('An error was generated while attempting to create '+
                '+the new Interbase database'+#13+ E.Message, mtError, [mbOK], 0);
          end;
        finally
          Params.Free;
        end; {try..finally}
      end; {if CreateNewAliasRadio}
    Close;
  except
    on E: Exception do
      begin
        if MessageDlg('An error has occurred: ' + #13 + e.Message + #13 +
          'Would you like to roll back and try again?',
          mtError, [mbYes, mbNo], 0) = mrNo then
            Exit;

        try
          DeleteFile(IBDBPath.Text);
        except
        end;

        try
          Session.DeleteAlias(AliasNameEdit.Text);
          Session.SaveConfigFile;
        except
        end;

      end;
  end; {try..except}
end; {OKButtonClick}

IBDatabase is a TIBDatabase component located on the Interbase tab within Delphi.

IBDBPathEdit, UsernameEdit, PasswordEdit, PageSizeEdit,
AliasNameEdit are all edit boxes.  There names are self explanatory.

CreateNewAliasRadio is a radio button.  There's two of them : CreateNewAliasRadio and DoNotCreateNewAliasRadio

Once you have created your database using this procedure, you can open it using a TQuery and then execute SQL against it.

For instance, to create this table:

FIRSTNAME   STRING LENGTH 50
LASTNAME    STRING LENGTH 50
PHONENO     STRING LENGTH 25
POSTCODE    STRING LENGTH 8
NUMBOFEYES  INTEGER

You would do this:

CREATE TABLE PERSONALDETAILS (
FIRSTNAME CHAR(50),
LASTNAME CHAR(50),
PHONENO CHAR(25),
POSTCODE CHAR(8),
NUMBOFEYES INTEGER)

You don't call Query.Open either, you call Query.ExecSQL when creating, altering, dropping, inserting or updating tables.

Hope this helps,

Stu
0
 

Author Comment

by:girlswants_me
ID: 6970674
Thank you for such a brilliant answer.
0
 
LVL 6

Expert Comment

by:Stuart_Johnson
ID: 6970731
No problems at all :)  Just let me know if you have any more problems with the code or answer.

Stu
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now