![]()
TAccessDSNCreator
Microsoft Access DSN Creation Component
Most recent updates to this and other files can be found at:
http://www.gwacc.com/software.htm
What is it?
This component is used to Add, Reconfigure and Remove
MS Access Datasource Names (DSNs) on the fly. Usually this
is done via the ODBC32 control panel applet in any standard windows
installation.
Why use it?
Ever needed to create a Microsoft Access Datasource Name (DSN)
on the fly from inside your Delphi code? We certainly have! This incredibly
useful little component allows you to create, modify and delete DSNs at
runtime from a 32bit Development Environment.
Why would you want to do this? Quite often we (as developers at GWAcc) find ourselves having to climb into the control panel and muck around inside the ODBC32 applet. It gets annoying, especially if you have to do it several times in a row, even more so when it means having to switch between changing user names, passwords, paths, exclusivity... you get the idea!
This control allows you to add or change all the properties of a Microsoft Access DSN, in a single movement.
We've just released an ActiveX version of the component which will allow you to add, configure and remove Access DSNs from your system using any other language/development environment that supports ActiveX controls. These include Borland Delphi, Visual Basic, Borland C++ Builder, Microsoft Visual C++ and many others. Demo programs for its use are included in the package.
The control is completely standalone and doesn't require any dependancy files or Visual Basic runtime libraries.
Simply set a couple of properties, add ONE line of code to your application, and you can Add, Reconfigure and Remove MS Access DSNs in a flash!
An example application has been included with the component, that you can use to check the assignment of properties and invocation of methods.
About : Displays an 'About' box, with your registered status and our contact details
Action : TDSNExecuteAction
The action to perform when the Execute method is invoked. The action can
consist of the following values:
DSNNameOrAlias
: String
The name for the DSN as it will appear in the drop down list of aliases
available to the development environment. This is the internal name used
by the ODBC drivers. No spaces to occur in this string. The component will
accept them, but then if you try to modify the DSN via the control panel,
it might get upset with you. Example: "TstDSN"
DSNUserDescription
: String
The name that you will refer to it by, kind of like a comment string.
After all "My Test DSN" is a lot more meaningful than "TstDSN".
DatabaseFile
: String
The fully qualified path to an existing MS Access database file (if it exists).
The control does NOT check to see if the file already exists, since
you may want to create the database on the fly as well, either prior to
or subsequent to using this control.
Example "c:\testapplication\test.mdb"
UserID : String
Some MS Access databases require a login and a password to be able to open
them. This is the login name.
Example: "JoeSoap"
WorkGroupFile
: String
Some MS Access databases require a workgroup file used to control user access,
table locking and so on based on the user. This property allows you to set
the path to this. Again, the control will NOT check to see if this file
exists first, since this may also need to be created on the fly.
Example "c:\testapplication\test.mdw"
WorkingDir :
String
Sometimes a working directory also needs to be specified. If left blank,
the control will automatically set it to the directory of the DatabaseFile
property. Again, no path checking takes place.
Example "c:\testapplication\" or "c:\testapplication"
(the trailing backslash doesn't matter)
Password : String
Some MS Access databases require a login and a password to be able to open
them. This is the password that must be supplied if necessary
Example: "TestPass"
The following extended options are directly applicable to the DSN type and affect how the ODBC32 drivers will handle your databases. You can check these values by opening control panel, running the ODBC32 applet, double clicking any MS Access DSN and looking under the advanced options for it.
optExtendedAnsiSQL
: Integer
optImplitCommitSync : String
optMaxBufferSize : Longint (MUST be a multiple of 512)
optMaxScanRows : Longint
optPageTimeout : Longint
optDSNReadOnly : Boolean
optExclusive : Boolean
optSafeTransactions : Longint
optThreads : Longint
optUserCommitSync : Boolean
Methods:
This component only has one method.
Execute : Boolean
This method triggers the action you defined by the Action property above.
Some of the properties may not actually need to be used, for example with
the REMOVE_DSN action, only the DSNNameOrAlias needs to be supplied. The
action is synchronous, and the function will return only after it has attempted
the action you requested.
Returns: True = Your action succeeded, False = Your action failed (for example
trying to remove a nonexistent DSN.
Note: For unregistered users, if the DSN already exists, it will return 'False' and the DSN will not be updated. It will only return true and create the DSN if it did not already exist. Unregistered users will need to delete the DSN via the control panel ODBC32 applet before it can be recreated. This is not an issue for registered users or for those who have bought the source code.
Events
This component triggers no events
Installation
Unzip the package you downloaded.
In Delphi, go to "Components" | "Install Packages" menu
item, click on the "Add" button and select MSAccessDSN_Dxx.bpl
file from the box that pops up.
A new page will appear on the component palette (GWACC) with the
component(s) on it. In order to compile and run the included example application,
as well as any other application you create using this component, you will
also need to add the path to the .dcu files to your environment search path.
Do this in Delphi by going to "Tools" | "Environment Options" | "Library" and adding the path to the "Library Path" settings. If don't add the path to the Delphi Library Search Path, you'll get an error when compiling an application that the compiler can not find 'AccessDSNCreateUnit.pas' or 'AccessDSNCreateUnit.dcu'.
If you bought the source for the software, simply go to "File" | "Open" in Delphi and select the "MSAccessDSN_DX.dpk" package. This was designed for Delphi 4, but will work fine in Delphi 5 and should work for other versions such as Delphi 6, and Borland C++Builder too. In this case it will ask you if you want to upgrade the package to the new format. Answer "Yes", and then click on the "Compile" button. After this is complete, click on the the "Install" button to install the component on the GWACC page (default) or on the page you selected. See above about adding the path to the units to the Delphi library search path if you get any errors during compilation.
Installation - Delphi 6 Users - File Not Found - DsgnIntf.dcu/Proxies.dcu
A number of Delphi 6 users have reported a problem with the compilation of the source code, reporting units not found and other errors. The steps below should remedy the problem:
If you downloaded the shareware trial release, the file will be called MSAccessDSN_DxU.bpl where 'x' corresponds to the delphi version you are using. The registered version will simply be named MSAccessDSN_Dx.bpl. You will also need to add the path to the .dcu files to your environment search path. Do this in Delphi by going to "Tools" | "Environment Options" | "Library" and adding the path to the "Library Path" settings.
To uninstall the ActiveX do the following:
Redistribution
Please be aware that you may need to redistribute the "MSAccessDSN_DX.bpl"
package if you compile your project with the option to use runtime packages
turned on. This file will need to be copied to the client's Windows System
folder (usually "c:\windows\system").
Users of the ActiveX version will need to distribute the AccessDSNAX.ocx with their application. Please not NOT distribute the AccessDSNAX.lic file along with it, as this is only used in the design time environment and does not affec the actual running of the program.
History of changes
July 20, 2001. 1.0.0.2 First public release.
Feb 23 2003 ActiveX v1.0.2.47 version released
Future plans:
Apart from any possible bug fixes, there are no major changes planned for
this component
Known bugs
There are no known bugs at this time. If you find some bugs, please report
them to gwacc@kagi.com. The support email
address gwacc@kagi.com is available for
all your comments, questions and ideas. If you'd like to see some additional
functionality in this component, please let us know!
Benefits of registration
By registering one or more licenses, you have the right to incorporate this
component into as many applications as you like, royalty-free. If you decide
to purchase the license for this, or any other GWAcc component, you will get
one year of free upgrades. New versions of components will be available to
you at significantly lower price after the period of one year (during which
you get all new versions for free).
How to register
Visit http://www.gwacc.com/software.htm
and register online. All major credit cards apply through secure Internet
protocol. You can also register via fax, international mail order, bank wire
or US Check.
License :
Please read carefully EULA_license.txt file before using this software.
In addition to this, GWAcc grants you the license to distribute the shareware version ONLY of this component, however you see fit, as long as ALL the files are kept together in one archive. We will not levy any charges for your distributing of the shareware components in any format, electronic or otherwise.
You may NOT redistribute the registered or source code versions of this software to anyone, except with the express, written permission of GWAcc Limited.