Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Return a list of all installed ODBC drivers

Posted on 2013-01-25
8
Medium Priority
?
785 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
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…

610 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