Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Registering database

SaMoSaMo Posts: 36Member
As is well-known, any database program written in Delphi requires Borland Database Engine to operate. Therefore every time I write a program using databases I have to manually register my database in BDE Administrator. This causes a lot of inconvenience when I need to install a program on the other computer. Although I tried, I was not able to write a program that will register the database itself (which could be very valuable for instance in setup application).

Is there any way to do it? Thanks in advance.

Comments

  • MasterijnMasterijn Posts: 188Member
    : As is well-known, any database program written in Delphi requires Borland Database Engine to operate. Therefore every time I write a program using databases I have to manually register my database in BDE Administrator. This causes a lot of inconvenience when I need to install a program on the other computer. Although I tried, I was not able to write a program that will register the database itself (which could be very valuable for instance in setup application).
    :
    : Is there any way to do it? Thanks in advance.
    :
    Hai,
    What about not registering the connection parameters as an alias? Load it from a file like:
    [code]
    procedure SetConnectionFile(DB: TDatabase; Filename: string);
    begin
    DB.Connected := False;
    with DB.Params do
    begin
    Clear;
    LoadFromFile(ExtractFilePath(ParamStr(0)) + Filename + '.bde');
    end;
    end;
    [/code]
    Ore you can hard code it. Using aliases is only optional!
  • SaMoSaMo Posts: 36Member
    : : As is well-known, any database program written in Delphi requires Borland Database Engine to operate. Therefore every time I write a program using databases I have to manually register my database in BDE Administrator. This causes a lot of inconvenience when I need to install a program on the other computer. Although I tried, I was not able to write a program that will register the database itself (which could be very valuable for instance in setup application).
    : :
    : : Is there any way to do it? Thanks in advance.
    : :
    : Hai,
    : What about not registering the connection parameters as an alias? Load it from a file like:
    : [code]
    : procedure SetConnectionFile(DB: TDatabase; Filename: string);
    : begin
    : DB.Connected := False;
    : with DB.Params do
    : begin
    : Clear;
    : LoadFromFile(ExtractFilePath(ParamStr(0)) + Filename + '.bde');
    : end;
    : end;
    : [/code]
    : Ore you can hard code it. Using aliases is only optional!
    :

    Correct me if I am mistaken. The expression "ExtractFilePath(ParamStr(0)) + Filename + '.bde'" is just a file of my database, right? However, trying to register the base as you suggest, I receive a message "Invalid alias", and the base does not open. The only way it worked, was if I removed the Database component alltogether and entered file name directly into Table.DatabaseName property of the data table. Ist that what you meant?

  • MasterijnMasterijn Posts: 188Member
    : : : As is well-known, any database program written in Delphi requires Borland Database Engine to operate. Therefore every time I write a program using databases I have to manually register my database in BDE Administrator. This causes a lot of inconvenience when I need to install a program on the other computer. Although I tried, I was not able to write a program that will register the database itself (which could be very valuable for instance in setup application).
    : : :
    : : : Is there any way to do it? Thanks in advance.
    : : :
    : : Hai,
    : : What about not registering the connection parameters as an alias? Load it from a file like:
    : : [code]
    : : procedure SetConnectionFile(DB: TDatabase; Filename: string);
    : : begin
    : : DB.Connected := False;
    : : with DB.Params do
    : : begin
    : : Clear;
    : : LoadFromFile(ExtractFilePath(ParamStr(0)) + Filename + '.bde');
    : : end;
    : : end;
    : : [/code]
    : : Ore you can hard code it. Using aliases is only optional!
    : :
    :
    : Correct me if I am mistaken. The expression "ExtractFilePath(ParamStr(0)) + Filename + '.bde'" is just a file of my database, right? However, trying to register the base as you suggest, I receive a message "Invalid alias", and the base does not open. The only way it worked, was if I removed the Database component alltogether and entered file name directly into Table.DatabaseName property of the data table. Ist that what you meant?
    :
    :
    Nop, it's a inifile with settings. Don't use aliases then.
  • rajsharajsha Posts: 75Member
    Why don't u use installshield Express to install your program. It also installs the BDE as well as configures it. If u use ADO components then u won't need the BDE, but you'll require the stand alone version of Installshield to install the ODBC DSN.
    : : : : As is well-known, any database program written in Delphi requires Borland Database Engine to operate. Therefore every time I write a program using databases I have to manually register my database in BDE Administrator. This causes a lot of inconvenience when I need to install a program on the other computer. Although I tried, I was not able to write a program that will register the database itself (which could be very valuable for instance in setup application).
    : : : :
    : : : : Is there any way to do it? Thanks in advance.
    : : : :
    : : : Hai,
    : : : What about not registering the connection parameters as an alias? Load it from a file like:
    : : : [code]
    : : : procedure SetConnectionFile(DB: TDatabase; Filename: string);
    : : : begin
    : : : DB.Connected := False;
    : : : with DB.Params do
    : : : begin
    : : : Clear;
    : : : LoadFromFile(ExtractFilePath(ParamStr(0)) + Filename + '.bde');
    : : : end;
    : : : end;
    : : : [/code]
    : : : Ore you can hard code it. Using aliases is only optional!
    : : :
    : :
    : : Correct me if I am mistaken. The expression "ExtractFilePath(ParamStr(0)) + Filename + '.bde'" is just a file of my database, right? However, trying to register the base as you suggest, I receive a message "Invalid alias", and the base does not open. The only way it worked, was if I removed the Database component alltogether and entered file name directly into Table.DatabaseName property of the data table. Ist that what you meant?
    : :
    : :
    : Nop, it's a inifile with settings. Don't use aliases then.
    :

  • pak77pak77 Posts: 28Member
    : : : : "As is well-known, any database program written in Delphi requires Borland Database Engine to operate."

    I'm glad to say that this is very far from the truth. I wouldn't even contemplate creating a database program using the BDE. There are plenty of components out there that will allow you to connect to other types of databases such as 'Access' and the like, if you do not already have the ado components that come with certain versions of delphi. Obviously this all depends on whether you have other database software to connect to. But i would strongly advise to stay away from the BDE.
  • SaMoSaMo Posts: 36Member
    : : : : : "As is well-known, any database program written in Delphi requires Borland Database Engine to operate."
    :
    : I'm glad to say that this is very far from the truth. I wouldn't even contemplate creating a database program using the BDE. There are plenty of components out there that will allow you to connect to other types of databases such as 'Access' and the like, if you do not already have the ado components that come with certain versions of delphi. Obviously this all depends on whether you have other database software to connect to. But i would strongly advise to stay away from the BDE.
    :

    That is true. However, as far as I know (what I read in several books on Delphi programming), refusing to use BDE may decrease the speed of working with data significantly (20 times and more in some cases). I do not know whether that is really the case, but that is what I read.
  • pak77pak77 Posts: 28Member
    : That is true. However, as far as I know (what I read in several books on Delphi programming), refusing to use BDE may decrease the speed of working with data significantly (20 times and more in some cases). I do not know whether that is really the case, but that is what I read.
    :

    I cant pass comment on what the books you have read say, as I dont know which books they are. But I wouldn't mind guessing that the author has some association with Borland and therefore chooses to promote their own software.

    Whilst using delphi 5 and not having the ado components that ship with certain versions of delphi I used the BDE to open both Paradox and Access databases. Neither way compared to 3rd party components I downloaded to connect directly to access databases, in particular, diamond access components. If you have the opportunity to create an access database I would recommend you visit www.islamov.com and download the diamond access components. If you can get the BDE to work 20 times faster than these components I would be grateful to know how!





  • SaMoSaMo Posts: 36Member
    : : That is true. However, as far as I know (what I read in several books on Delphi programming), refusing to use BDE may decrease the speed of working with data significantly (20 times and more in some cases). I do not know whether that is really the case, but that is what I read.
    : :
    :
    : I cant pass comment on what the books you have read say, as I dont know which books they are. But I wouldn't mind guessing that the author has some association with Borland and therefore chooses to promote their own software.
    :
    : Whilst using delphi 5 and not having the ado components that ship with certain versions of delphi I used the BDE to open both Paradox and Access databases. Neither way compared to 3rd party components I downloaded to connect directly to access databases, in particular, diamond access components. If you have the opportunity to create an access database I would recommend you visit www.islamov.com and download the diamond access components. If you can get the BDE to work 20 times faster than these components I would be grateful to know how!

    Thanks for info and the link! I will certainly try it!
  • softmansoftman Posts: 157Member
    Hi!

    In case of still using BDE, you can try Session managament. Add to uses list: DBTables.

    Here is an examle from delphi7 help file:

    The following example specifically creates a local alias pointing to the application directory. Note that this alias is automatically deleted when the application terminates and will not be saved to the BDE configuration file.
    [code]
    begin

    with Session do
    begin

    ConfigMode := cmSession;

    try
    AddStandardAlias('TEMPDB', ExtractFilePath(ParamStr(0)), 'PARADOX');
    finally
    ConfigMode := cmAll;
    end;
    end;
    [/code]

    Adds a standard Borland Database Engine (BDE) alias to the session for Paradox, dBASE, or ASCII tables.

    Delphi syntax:

    procedure AddStandardAlias(const Name, Path, DefaultDriver: String);

    C++ syntax:

    void __fastcall AddStandardAlias(const AnsiString Name, const AnsiString Path, const AnsiString DefaultDriver);

    Description

    Call AddStandardAlias at runtime to create a session-specific BDE alias for Paradox, dBASE or ASCII tables. Name is the unique name to assign to the alias. Path specifies the directory where the database is located. DefaultDriver is the name of the standard BDE driver to use for the alias. If set, DefaultDriver must be one of Paradox, DBASE, or ASCIIDRV. If left blank DefaultDriver defaults to Paradox. DefaultDriver is used when attempting to open a table that both does not have an extension and is defined as a table of type ttDefault.

    A sessions ConfigMode property determines whether an alias is local to the session, or is available to all applications in the BDE persistent store as long as any BDE clients are active. the lifetime of the session. To save an alias permanently, call the SaveConfigFile method before ending the session.

    Note: To create an alias for an SQL database, call AddAlias instead of AddStandardAlias.


    I hope, this is what you looking for.

    Softman

    : : : That is true. However, as far as I know (what I read in several books on Delphi programming), refusing to use BDE may decrease the speed of working with data significantly (20 times and more in some cases). I do not know whether that is really the case, but that is what I read.
    : : :
    : :
    : : I cant pass comment on what the books you have read say, as I dont know which books they are. But I wouldn't mind guessing that the author has some association with Borland and therefore chooses to promote their own software.
    : :
    : : Whilst using delphi 5 and not having the ado components that ship with certain versions of delphi I used the BDE to open both Paradox and Access databases. Neither way compared to 3rd party components I downloaded to connect directly to access databases, in particular, diamond access components. If you have the opportunity to create an access database I would recommend you visit www.islamov.com and download the diamond access components. If you can get the BDE to work 20 times faster than these components I would be grateful to know how!
    :
    : Thanks for info and the link! I will certainly try it!
    :

  • SaMoSaMo Posts: 36Member
    : I hope, this is what you looking for.
    :
    : Softman

    That really is exactly what I was looking for, and it worked perfectly well! Thanks a lot!
Sign In or Register to comment.