Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to connect to ACCESS database ?

Status
Not open for further replies.

sircsaba

MIS
Oct 15, 2002
6
0
0
CA
Hi,

This sounds stupid but how do I connect to an Access DB ? I setup an Alias in the BDE and it asks me for a username and password ...??? I also tried using a TTable component on a form and I still get the same password Dialog !!! The Access DB that I'm trying to connect to on my local machine has no username or password ...

I downloaded a software that connects to the Access DB and I was able to view the data. I would like to do the same and extract all the data into a Paradox file but I can't seem to get connected to it ... What am I doing wrong ???

Regards !!

 
Ok I hope this helps. Single Click on your ADO component(The one you use to connect to your access databse.)

On your left in the 'Properties' menu look for 'LoginPrompt'. Set that to 'False'. Its 'True' by default.

It should work. Hopefully this helped.


 
Hi, I'm using BDE on Delphi 7, but I believe the TDatabase main methods and properties remain very much the same.

Using BDE, (officially) you can connect to MS Access .mdb files using one of these drivers:
- MSACCESS (Delphi native driver)
- Microsoft Access Driver (*.mdb) (ODBC)

Apparently MSACCESS driver is not too reliable (on my experience), so I used the ODBC driver.

Create a user DSN using "Microsoft Access Driver (*.mdb)" and specify this on your TDatabase component:
- DriverName: Microsoft Access Driver (*.mdb)
- DatabaseName: <anything>
- LoginPrompt: False
- Params:
DATABASE NAME=<your database name>
USER NAME=Admin
ODBC DSN=<your DSN>
OPEN MODE=READ/WRITE
SCHEMA CACHE SIZE=8
SQLQRYMODE=
LANGDRIVER=
SQLPASSTHRU MODE=SHARED AUTOCOMMIT
SCHEMA CACHE TIME=-1
MAX ROWS=-1
BATCH COUNT=200
ENABLE SCHEMA CACHE=FALSE
SCHEMA CACHE DIR=
ENABLE BCD=FALSE
ROWSET SIZE=20
BLOBS TO CACHE=64
PASSWORD=<your mdb password, if any>

After everything set, try to change the Connected property to TRUE. It should be work and you should be able to use TTable or TQuery to connect to your Access mdb files.

Good luck.





 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top