Solved

linking Database with Multi-user design

Posted on 2002-04-25
10
196 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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
 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
delphi exception 7 68
Delphi: how to implement a User Shortcut mapper? 1 121
select query - oracle 16 100
How to Get Images From Server using App Tethering 11 40
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

821 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