Solved

Return a list of all installed ODBC drivers

Posted on 2013-01-25
8
752 Views
Last Modified: 2013-01-26
Hi,

I'm finalizing a small project I'm working on and I would like to be able to return a list of all installed ODBC drivers to the user so they can select one to use.

Currently, when my project is installed and run on a computer for the first time the user is asked to supply MySQL Server Name, Database, username and password.  All this data is saved to an INI file and is used to run a DNSless connection string to join the required tables from the MySQL server.

My reason for asking this question is this.  Currently the ODBC driver is hard coded into my code and therefore requires the end user to install a specific MySQL ODBC driver.  What I would like to do is allow the user to install any MySQL ODBC driver and then, when they run the programme for the first time they can select the driver from a listbox, enter the relevant server information and continue with the application as normal.

Can anyone point me in the right direction?
0
Comment
Question by:anthonytr
  • 5
  • 3
8 Comments
 
LVL 57
ID: 38819735
<<Can anyone point me in the right direction? >>

See the following:

http://msdn.microsoft.com/en-us/library/ms714818(v=vs.85).aspx

 The reg key is valid up through Windows 7 at least.

 Not sure about 32 vs 64 bit drivers though.

Jim.
0
 
LVL 57
ID: 38819739
You want the drivers sub-key by the way.

Jim.
0
 
LVL 57
ID: 38819748
I just looked.  On a 64 bit OS, the 32 bit drivers will be in:

HKLM\Software\Wow6432Node\ODBC\ODBCINST.INI

Jim.
0
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 

Author Comment

by:anthonytr
ID: 38819790
Thanks Jim for this.  How would i display this information in a Listbox to the user?

For example my current connection string is:

stConnect = "ODBC;Driver=MySQL ODBC 5.2a Driver;Server;SERVER=" & stServer & ";DATABASE=" & stDatabase & ";Trusted_Connection=Yes"

As you can see ODBC;Driver=MySQL ODBC 5.2a Driver is my installed and hard coded driver.
0
 
LVL 57
ID: 38819910
You can use the code in the following blog to read the key:

http://blogs.msdn.com/b/alejacma/archive/2008/04/11/how-to-read-a-registry-key-and-its-values.aspx

  You'll then need to feed the list box.  Not sure exactly what your working in.  You could dump the data into a table and hook the list box to that, stuff the values into the list box one by one, or have a call back function to fill the list control and requery it.

Jim.
0
 

Author Comment

by:anthonytr
ID: 38819997
Thanks, I'm running MS Access VBA.
0
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
ID: 38820078
<<Thanks, I'm running MS Access VBA. >>

 The code for reading the reistry key will drop right in and all of the methods I mentioned would be doable for getting the data into the list control, plus additionally, you could set the list control rowsource to value and fill the rowsource.

 So there are four different ways to get the data into the list control.

 Given the limited number of entires you would have (couple dozen at most), I would opt for using a value list or a callback function.

Jim.
0
 

Author Comment

by:anthonytr
ID: 38820154
Thank you!
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

775 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