Solved

Help needed connecting to a MS Access DB via ADO

Posted on 2006-11-11
16
212 Views
Last Modified: 2013-11-23
Hi,

I am using Delphi 6 and connecting to an MS Access 2003 database file.

I basically have written an install program which installs the needed files (so I think ???) to run the application - the database mdb file, the Application exe, an ini file and the following qtintf.dll ??.

The install works and the application runs on my pc (which it should), but when I go to install it on another pc, and then run it - a login dialog appears asking for an admin password.

I have checked other questions and answers within EE, and have set login prompt to False, User ID ="", set the database password etc...., but still cannot get the application to run. It appears to only happen on pc's that do not have MS ACCESS installed ?

I thought that Windows XP SP2 should have relevant drivers - MDAC etc.. required.

I am wanting to Secure the MS Access database file so that it cannot be copied and open via MS Access, and only opened via my Application via my login dialog.

Any urgent help would be greatly appreciated.

Thanks
PJE
0
Comment
Question by:pjelias
[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
  • 4
  • 3
  • +1
16 Comments
 

Author Comment

by:pjelias
ID: 17924762
I have now tried absolutely everything I can find, but still have no luck.

The Application will load the database and run OK on my pc, but keeps asking for the login prompt on a pc that does not have MS Office / Access installed.

Sounds like a file is missing but which one ?
0
 
LVL 6

Expert Comment

by:so3
ID: 17924793
Post your connection string to see if you wrote it correctly. This works for me in my applications that use password protected mbd files (of course the login prompt set to false). you see that i don't put the user id in the connection string

sCon:='Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password=somepassword;Data Source='+Filename+';Persist Security Info=False';


0
 
LVL 6

Accepted Solution

by:
so3 earned 250 total points
ID: 17924796
Also if you still get the login try to use the user id set to admin.



sCon:='Provider=Microsoft.Jet.OLEDB.4.0;Uid=Admin;Jet OLEDB:Database Password=somepassword;Data Source='+Filename+';Persist Security Info=False';
0
Technology Partners: 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 11

Expert Comment

by:calinutz
ID: 17925007
You cannot protect your mdb from being opened by ACCESS this way. There are Access password crackers on the net... just look them up on google
In order to achieve that you would have to consider building an encryption/decryption algorithm that would decrypt your mdb somewhere hidden every time your program opens it, and re-encrypt it when your app closes.
This is also crackable since there will be an un-encrypted file on your users harddrive while the app is running. But if you decide to give it a name that would not raise suspicions, maybe give up on the mdb extension, place your db file somewhere in windows/system32 or stuff like that.

Also setting a password on the mdb is very risky for the case your mdb file gets corrupted... and the tool that could help you recover data will not work because the password that is needed to "open" the database also gets corupted... Trust me on this, I had this situation a couple of times.

As for your problem... does it come up when you try to install the application or when you try to run it?
- XP SP2 has the MDAC 2.8 I think installed automatically (you can't get rid of it even if you would want to), so the problem to connect to your mdb using ADO is solved
- your password is requested by the database connection? or is it requested by your application (>"via my login dialog"<)? Or is it requested by windows when you try to install the app?
 There are multiple posibilities, so please be more specific.


Cheers

0
 
LVL 11

Assisted Solution

by:calinutz
calinutz earned 150 total points
ID: 17925019
0
 

Author Comment

by:pjelias
ID: 17926293
The application installs OK, it is when I go to run the application that an ACCESS dialog or ADO dialog appears asking for the Username and Password - this is not my login dialog.

This appears before my login dialog. I have tried all user id and password combinations, but the dialog keeps appearing, as if the password is not successful until an error occurs.
0
 

Author Comment

by:pjelias
ID: 17926762
Tried the MDBSecure above - would not let me open the DB file without using MDBSecure ???

I even tried without a password on the database and that would not work either, also get a login prompt asking for a user id and password.

It appears that it just does not want to open unless MS Office / Access is installed.

How can I tell what files are needed/missing ?


0
 
LVL 6

Expert Comment

by:so3
ID: 17928310
pjelias,

Did you tried to use the connections strings that i've posted above?
0
 
LVL 17

Assisted Solution

by:Wim ten Brink
Wim ten Brink earned 100 total points
ID: 17928579
> I am wanting to Secure the MS Access database file so that it cannot be copied and open via MS Access, and only opened via my Application via my login dialog.

With Access? Impossible... :-)
If you want to make it harder for the user to access the data in your database then I'd suggest you use some other type of database. There are quite a few alternatives.

Also check out http://coding.derkeiler.com/Archive/Delphi/borland.public.delphi.language.objectpascal/2003-12/0008.html about that QTINTF.DLL library. Apparantly you're using a CLX unit in your code somewhere. Really annoying buggers, those libraries. Originally created for compatibility with Kylix but in the end about as useless as CALC.EXE... :-) (Well, useless if you have a real calculator next to your computer anyways...)
0
 
LVL 11

Expert Comment

by:calinutz
ID: 17928733
The login box you get is because your connection string.
So change / rebuild it and it will be ok.
Ok meaning that you wont get the login box again.
Use a ADO Connection component and set it's login promt to false, and then use it's connectionstring Builder.
It's piece of cake
0
 

Author Comment

by:pjelias
ID: 17928978
I have used the connection string builder, the login prompt is set to false and below is my connection string + code to open the database

I have also tried multiple variations to the string below - same results

cString is a String Variable
dbSource is the path location of the database obtained from an ini file

  cString:=cString+'Provider=Microsoft.Jet.OLEDB.4.0;';
  cString:=cString+'User ID=Admin;';
  cString:=cString+'Data Source='+dbSource+'\dbMaster.mdb;';
  cString:=cString+'Mode=Share Deny None;Extended Properties="";';
  cString:=cString+'Persist Security Info=True;';
  cString:=cString+'Jet OLEDB:System database="";';
  cString:=cString+'Jet OLEDB:Registry Path="";';
  cString:=cString+'Jet OLEDB:Database Password="";';
  cString:=cString+'Jet OLEDB:Engine Type=5;';
  cString:=cString+'Jet OLEDB:Database Locking Mode=1;';
  cString:=cString+'Jet OLEDB:Global Partial Bulk Ops=2;';
  cString:=cString+'Jet OLEDB:Global Bulk Transactions=1;';
  cString:=cString+'Jet OLEDB:New Database Password="";';
  cString:=cString+'Jet OLEDB:Create System Database=False;';
  cString:=cString+'Jet OLEDB:Encrypt Database=False;';
  cString:=cString+'Jet OLEDB:Don''t Copy Locale on Compact=False;';
  cString:=cString+'Jet OLEDB:Compact Without Replica Repair=False;';
  cString:=cString+'Jet OLEDB:SFP=False';

  adoConnect.Close;
  adoConnect.ConnectionString:=cString;
  adoConnect.Connected:=True;

Also, I think I found the CLX Unit - Qt - don't know why it was included in some of my files or how it got there, I remarked all occurrences, so this should no longer exist (I hope)

ps. don't knock CALC.EXE - great tool for those of us who don't seem to have a calculator that works around when we need one.
0
 

Author Comment

by:pjelias
ID: 17929145
so3,

appears your answer did the job - appears the most basic Connection String seemed to work.

I had your Values in, but had them included with other properties within my string.

Must be one of the other properties that caused the problem ?????

Also, Alex, I removed all references I could find for CLX units, and rebuilt the application as well as removed all qtintf*.dll files, yet when I install it on another pc and go to run the application, a msg appears saying that it could not find qtintf.dll ????

I searched for all of the following CLX units , but only found references to Qt, which I removed.

BindHelp.pas
QActnList.pas
QButtons.pas
QCheckLst.pas
QClipbrd.pas
QComCtrls.pas
QConsts.pas
QControls.pas
QDBActns.pas
QDBConsts.pas
QDBCtrls.pas
QDBGrids.pas
QDBLogDlg.pas
QDBPWDlg.pas
QDialogs.pas
QExtCtrls.pas
QForms.pas
QGraphics.pas
QGrids.pas
QImgList.pas
QMask.pas
QMenus.pas
QPrinters.pas
QSearch.pas
QStdActns.pas
QStdCtrls.pas
QStyle.pas
Qt.pas
QTypes.pas

0
 
LVL 6

Expert Comment

by:so3
ID: 17929185
pjelias,
yes the  Uid and Persist Security Info set to False
0
 

Author Comment

by:pjelias
ID: 17929225
Seems I was a bit premature in my awarding of points.

If I run the application by just manually copying the files to the other pc, with the qtintf.dll in the same directory as the EXE, the application works.

If I install the application via my installation process, with the qtintf.dll in the windows\system32 directory - the application comes up with the same error.

Ideally according to Alex (and Borland????), I should not be using qtintf.dll, but am unable to get rid of it ?????
0
 

Author Comment

by:pjelias
ID: 17929280
The application now appears to work - I updated my install program with updated files, HOWEVER, my application still requires qtintf.dll.

How do I get rid of this ?
(should possibly be another question, however since Alex raised the question .........????. )
0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 17929489
Unfortunately I'm at my work right now and can only answer during some short breaks. The need for that qtintf.dll means your application is still using a sourcefile that uses the QT library. (It's QT.pas that loads this library.) To find out which one, you will have to check ALL sourcefiles that you use and check their dependencies. It's a lot of work but there are solutions for this that might make it easier...

http://www.gexperts.org is a Delphi IDE expert and it has an option 'Project Dependencies' which will find all unit dependencies of your project. If you use it, export the whole list to a CVS file, open the file in Notepad and search for the QT unit then you probably find the link between this unit and some other units that sstill (secretly) uses this QT unit.

As an alternative, you can buy the Pascal Analyzer or use the Free Icarus analyzer from http://www.peganza.com/download.htm and let it analyse your project. Icarus is all you need for now since all you need to know are the unit relations.

However, the only solution to getting rid of this DLL is by going through your whole project, finding the path to this unit...
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
URL for downloading Google Chrome for Win XP 2 232
shape, triangle, dbctrlgrid 3 31
IP without any Dots 1 51
Add New Database Table in database file using delphi 3 27
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

740 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