From: jpearson@cpcug.org (John Pearson)
Newsgroups: comp.lang.pascal
Subject: Re: HOW TO Connect to an Access DB in Delphi
Date: Sat, 8 Apr 1995 09:29:37 LOCAL
Organization: Express Access Online Communications, USA

>Here is the step-by-step process that I took to connect my Delphi
>app. to an Access database:

Several clarifications that helped me make it work....

>1)      Open up the Windows Control Panel.
>2)      Open up the ODBC "Data Sources" icon.
>3)      ADD a new Data Source of Type ACCESS DATA.
>4)      Provide a unique "Data Source Name" (it doesn't really
>        matter what you call it - description is optional), 

but it helps to make the dsn unique (dsn_XXX) to distinguish it from other 
alias to follow.

>5)      Choose the Database File by clicking the "Select Database"
>        button.
>6)      Close the "Data Sources" window.
>7)      Open up the "Database Engine Configuration" to get to the
>        "DBE Configuration Utility" screen.
>8)      Click on the "NEW ODBC Driver" button.
>9)      Provide a "SQL Link Driver" - once again, it doesn't really
>        matter what you call it.
>10)     Select a Default ODBC Driver of type ACCESS DATA.
>11)     Under "Default Data Source Name" choose the name of the ODBC
>        driver that you provided from the Control Panel.  

These are offered to you as choices

>12)     Create a new alias by clicking on the "Alias" page tab.
>13)     Click on the "New Alias" button.
>14)     Give the alias a name.

You will see the dsn_XXX alias in the list.  You do not want this.  Choose a 
new alias (al_XXX) for uniqueness.

>15)     Select an Alias Type of ODBC_[WHATEVER YOU CALLED 
IT IN STEP 11]

>16)     Save your settings with File/Save.
>17)     You can now close the DBE Config. Utility
>18)     IN YOUR PROJECT ---
>        (I am sure that there are many ways to approach the next steps,
>        but here's what I did)
>        a)      Add a TDatabase component
>                1)      Set the AliasName to the new alias that you
>                        just defined.

Here you will see the dsn_XXX alias and the al_XXX alias listed as choices.  
Choose the BDE al_XXX alias.  My confusion arose from choosing the ODBC 
dsn_XXX and the BDE does NOT work with this one.  This is why it helps to 
name them independently.

>                2)      Provide a dummy DatabaseName.
>                3)      Set the LoginPrompt to FALSE (if you don't want
>                        permission checking).
>        b)      Add a TQuery component.
>                1)      Set the DatabaseName to the dummy name you
>                        provided in a.2)
>        c)      Add a TDataSource component.
>                1)      Set the DataSet to the name of the TQuery comp.


>And you are done!  You now have a SQL-ready, data-aware form that you
>can plop SQL into and data-aware components on to!

>As I said, this may not be the best way to do this, but it worked for me.
>Please add/subtract/rip-this-apart and update the newsgroup with the
>revisions.

>--- Dave Zaret

>...Standard disclaimer....
>My opinions and statement in no way reflect those of Swiss Bank Corp.

Its easy when you get the alias names right.  By the way you need the latest 
Access 2.0 version of ODBC. 

Reportsmith needs only the ODBC alias, while Delphi needs the BDE 
alias to connect to the ODBC alias.


