?
Solved

Return a list of all installed ODBC drivers

Posted on 2013-01-25
8
Medium Priority
?
774 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
[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
  • 5
  • 3
8 Comments
 
LVL 58
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 58
ID: 38819739
You want the drivers sub-key by the way.

Jim.
0
 
LVL 58
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
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 

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 58
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 58

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 2000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

777 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