Solved

Using data base without specifying its absolute path

Posted on 2004-09-20
7
268 Views
Last Modified: 2010-04-05
1.) How I Can connect to an database without specifying the absolute path of data base file.
     I need this because I have data base and exe file in folder c:/MyProgram, and this program will not work on other people's computers because maybe they will not hold program on the same address (for example c:/Programs/MyProgram... or so).

2.) Is it ok to use M. Access data base when I work with 50 000 records?
0
Comment
Question by:UrosVidojevic
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 7

Author Comment

by:UrosVidojevic
ID: 12101708
information:

I am using ADO.
0
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 12101850
if you have the Application and the DB in the same location just skip the path from the connectionstring leaving just the FileName (i.e. Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db1.mdb;Persist Security Info=False).
0
 
LVL 2

Expert Comment

by:gary_williams
ID: 12102056
Table.DatabaseName := ExtractFilePath(Application.EXEName) + 'mytable.db'
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 17

Accepted Solution

by:
Wim ten Brink earned 50 total points
ID: 12102487
Personally, I prefer to use an INI file in which I store the path of the database. This would allow you to put it anywhere you like. At the start of the application you could check if the file exists and if it doesn't, pop up a file dialog screen asking the user to enter where the database is located.
If you use the TADOConnection then by setting the path in the connectionstring should solve it quite easily. Simply use:
  ADOConnection1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+ExtractFilePath(ParamStr(0)+'Database.mdb;Persist Security Info=False';

Now, using Access with 50.000 records should be okay. I've done worse. But it won't perform as fast. Using Oracle, InterBase or SQL Server would be faster. I do hope your system has a lot of memory, though. If you do a query that returns all those records, they will all be put in memory and if there's not enough memory the swapfile will be used. Not that this won't happen with other databases, though. But be aware that if you use large amounts of records then always try to keep your datasets as small as possible in some way.
Also be aware of transactions. Make sure they're committed or else again, memory problems...
0
 
LVL 7

Author Comment

by:UrosVidojevic
ID: 12103893
I have some problems with giving the points to Alex, because when I click accept it tells me Error

ERROR
Answer not found (ID: 11).

Do you know what's the problem?
0
 
LVL 45

Expert Comment

by:aikimark
ID: 12107826
I agree with Alex that you should retain the location of the MSAccess database between executions either in an INI file, XML config file, or in the Windows registry.  If the path is not known, allow the user to select the path, starting with the application directory.  Access can easily handle 50k rows.

If you have performance problems with your MSAccess database, look at the following as potential remedies:
* launch the JetComp.exe utility to repair and compact the database
* look at the queries you are executing.  There are often too few or too many indexes.
* also make sure that you execute as many stored queries as possible, converting your dynamic SQL into MSAccess querydefs.
* replace your MSAccess database with an MSDE database, which mimics a SQL Server.
* do some query optimization
   > retrieve only the columns you need
   > look for inefficiencies in your WHERE clause
   > look at your table join efficiencies
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

710 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