Solved

Return a list of all installed ODBC drivers

Posted on 2013-01-25
8
757 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

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.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
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…

808 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