MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Mar 25th, 2002, 01:34 PM   #1
Vlip
New Member
 
Join Date: Mar 2002
Location: Forest, VA
Posts: 45
Default

Hi,

Does anyone have an API that will allow me to get a list of ODBC data sources defined in the Windows ODBC Control Panel?

Thanks in advance,
Vlip
Vlip is offline   Reply With Quote
Old Mar 25th, 2002, 01:50 PM   #2
Tom Schreiner
Board Regular
 
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
Default

Much easier to call it out of the registry

HKEY_LOCAL_MACHINE
SOFTWARE
ODBC
ODBCINST.INI <<<< There's the list

Good Luck!
Tom

Tom Schreiner is offline   Reply With Quote
Old Mar 26th, 2002, 01:03 PM   #3
Vlip
New Member
 
Join Date: Mar 2002
Location: Forest, VA
Posts: 45
Default

Hi,

Thanks for your help! I'm sorry but I am new at this and am going to need a little more help. On my system,ODBCINST.INI lists all the ODBC drivers installed. I want User and System DSNs created with these drivers. There is an ODBC.INI key that lists the system DSNs but not the User DSNs. I don't see a key in the path specified that lists User DSNs. Also, I don't really know how to get this list out of the registry. Any help there would be greatly appreciated.

Vlip
Vlip is offline   Reply With Quote
Old Mar 26th, 2002, 01:13 PM   #4
Tom Schreiner
Board Regular
 
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
Default

Sorry
Misunderstood you



This is where you will find user DSN's
HKEY_CURRENT_USERSoftwareOdbcOdbc.iniOdbc Data sources


This where you will find system DSN's

HKEY_LOCAL_MACHINESoftwareOdbcOdbc.iniOdbc Data sources

How do you need the data set up after taking it from the reistry?

Please Reply

Tom
Tom Schreiner is offline   Reply With Quote
Old Mar 27th, 2002, 02:03 PM   #5
Vlip
New Member
 
Join Date: Mar 2002
Location: Forest, VA
Posts: 45
Default

Hi,

Thanks for the reply. I have an app that allows users to query any one of a number of Oracle databases using the DAO library. I have a dialog box where the user now types in the Data source name as it appears in the Windows Control panel. They also have to type in all of the same information (user id, password, database name, etc) that is already entered in the control panel. I would like to change this from a simple text field to a listbox where the user can select the DSN and then I can read all the pertinent information into the appropriate fields. I have some code that allows me to read the value of a registry key that I obtained from John Walkenbach's book (Excel 2002 Power Programming with VBA) but I can't figure out how to obtain the actual list of keys in a specified path.
I suppose I would like to retrieve this list as an array of strings so I can set the .List property of the listbox.
Thanks again for all the help!

Br,
Vlip
Vlip is offline   Reply With Quote
Old Mar 29th, 2002, 10:09 AM   #6
Tom Schreiner
Board Regular
 
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
Default

Hi Again.
Are you perhaps speaking of File DSN's?
If all you need are user DSN's & Drivers.
In Sys Path see odbc.ini
Will list User Dsn's

If your frontend is running on the same or similiar systems, why not create a simple text file with settings information for each connection?

All the user should have to do is choose Oracle.SomeData and type in username and pw.

When the user chooses, your list would be populated with whatever you choose...

Am I missing your point here?

I apoligize if my density level is reaching critical mass! Am trying to understand what your deal is???

Tom
Tom Schreiner is offline   Reply With Quote
Old Mar 29th, 2002, 08:28 PM   #7
Vlip
New Member
 
Join Date: Mar 2002
Location: Forest, VA
Posts: 45
Default

No need to apologize. I greatly appreciate your assistance. I will try to give a clearer explanation of what I am after.
If you open the ODBC control panel, there is a button labelled Add. Click this button and you get another dialog box where you choose the driver to use, give the data source a name and enter other settings. This data source definition will then appear under the User DSNs tab or the System DSNs tab if that was selected before creating the new instance. My users already have these DSNs set up, one for each database they need to connect to. Ocassionally, a new database is added or one may be dropped or have some aspect altered.
I have created an Excel application as an add-in that has the current information stored in a worksheet but because these databases may change as I just stated, I have created a dialog box that allows the end-user to edit the list of DSNs stored in the worksheet. Rather than have the user simply type in the name of the DSN to use as it appears in the control panel, I would like to have a drop-down list that they can select from since some users don't even know how to access it or even if they did they might mis-type it. By the way, these DSNs are updated automatically by a corporate log-on script that I have no control over.
All I want is an array of strings that contains the names of the data source definitions configured on the computer running my app. You have already given me the path to the User and System DSNs, now all I need is a little help figuring out how to get this list out of the registry. As I mentioned before, given the path and registry key name, I have code that will return the value (for example, the UserID, password, etc). What I need help with however, is in obtaining the list of entries at a path two levels higher in the registry. That is, I want the list of items at ODBC.INI as an array of strings. I hope this better describes what I am trying to do. Thanks again for all your help.

Best regards,
Vlip
Vlip is offline   Reply With Quote
Old Apr 2nd, 2002, 10:16 AM   #8
Tom Schreiner
Board Regular
 
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
Default

Hi
This will be the first of three replies:
Please add ############################# to the lines of data you are needing to extract from the registry.
If you would rather E-Mail than post the keys needed: TsTom@hotmail.com

See next two replies:

Tom

[ This Message was edited by: TsTom on 2002-04-02 09:19 ]
Tom Schreiner is offline   Reply With Quote
Old Apr 2nd, 2002, 10:17 AM   #9
Tom Schreiner
Board Regular
 
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
Default

System DSN


REGEDIT4

[HKEY_LOCAL_MACHINESoftwareODBCODBCINST.INI]

[HKEY_LOCAL_MACHINESoftwareODBCODBCINST.INIODBC Core]
"UsageCount"=dword:00000004

[HKEY_LOCAL_MACHINESoftwareODBCODBCINST.INIMicrosoft Text Driver (*.txt; *.csv)]
"UsageCount"=dword:00000003
"Driver"="C:\WINDOWS\SYSTEM\odbcjt32.dll"
"Setup"="C:\WINDOWS\SYSTEM\odtext32.dll"
"APILevel"="1"
"ConnectFunctions"="YYN"
"DriverODBCVer"="02.50"
"DSN"="Text Files"
"FileExtns"="*.,*.asc,*.csv,*.tab,*.txt,*.csv"
"FileUsage"="1"
"SQLLevel"="0"
"DriverID"="27"

[HKEY_LOCAL_MACHINESoftwareODBCODBCINST.INIODBC Drivers]
"Microsoft Text Driver (*.txt; *.csv)"="Installed"
"Microsoft Access Driver (*.mdb)"="Installed"
"Microsoft dBase Driver (*.dbf)"="Installed"
"Microsoft Excel Driver (*.xls)"="Installed"
"Microsoft ODBC for Oracle"="Installed"
"Microsoft Paradox Driver (*.db )"="Installed"
"SQL Server"="Installed"
"Microsoft Visual FoxPro Driver"="Installed"
"Microsoft dBase VFP Driver (*.dbf)"="Installed"
"Microsoft FoxPro VFP Driver (*.dbf)"="Installed"
"Microsoft FoxPro Driver (*.dbf)"="Installed"

[HKEY_LOCAL_MACHINESoftwareODBCODBCINST.INIMicrosoft Access Driver (*.mdb)]
"UsageCount"=dword:00000003
"Driver"="C:\WINDOWS\SYSTEM\odbcjt32.dll"
"Setup"="C:\WINDOWS\SYSTEM\odbcjt32.dll"
"APILevel"="1"
"ConnectFunctions"="YYN"
"DriverODBCVer"="02.50"
"DSN"="MS Access 97 Database"
"FileExtns"="*.mdb"
"FileUsage"="2"
"SQLLevel"="0"
"UID"="Admin"

[HKEY_LOCAL_MACHINESoftwareODBCODBCINST.INIMicrosoft dBase Driver (*.dbf)]
"UsageCount"=dword:00000003
"Driver"="C:\WINDOWS\SYSTEM\odbcjt32.dll"
"Setup"="C:\WINDOWS\SYSTEM\oddbse32.dll"
"APILevel"="1"
"ConnectFunctions"="YYN"
"DriverODBCVer"="02.50"
"DSN"="dBASE Files"
"FileExtns"="*.dbf,*.ndx,*.mdx"
"FileUsage"="1"
"SQLLevel"="0"
"DriverId"="533"

[HKEY_LOCAL_MACHINESoftwareODBCODBCINST.INIMicrosoft Excel Driver (*.xls)]
"UsageCount"=dword:00000003
"Driver"="C:\WINDOWS\SYSTEM\odbcjt32.dll"
"Setup"="C:\WINDOWS\SYSTEM\odexl32.dll"
"APILevel"="1"
"ConnectFunctions"="YYN"
"DriverODBCVer"="02.50"
"DSN"="Excel Files"
"FileExtns"="*.xls"
"FileUsage"="1"
"SQLLevel"="0"
"DriverId"="22"

[HKEY_LOCAL_MACHINESoftwareODBCODBCINST.INIMicrosoft ODBC for Oracle]
"UsageCount"=dword:00000002
"Driver"="C:\WINDOWS\SYSTEM\msorcl32.dll"
"Setup"="C:\WINDOWS\SYSTEM\msorcl32.dll"
"APILevel"="2"
"ConnectFunctions"="YYY"
"DriverODBCVer"="02.50"
"FileUsage"="0"
"SQLLevel"="1"
"CPTimeout"="60"

[HKEY_LOCAL_MACHINESoftwareODBCODBCINST.INIMicrosoft Paradox Driver (*.db )]
"UsageCount"=dword:00000003
"Driver"="C:\WINDOWS\SYSTEM\odbcjt32.dll"
"Setup"="C:\WINDOWS\SYSTEM\odpdx32.dll"
"APILevel"="1"
"ConnectFunctions"="YYN"
"DriverODBCVer"="02.50"
"DSN"="Paradox Files"
"FileExtns"="*.db"
"FileUsage"="1"
"SQLLevel"="0"
"DriverId"="538"

[HKEY_LOCAL_MACHINESoftwareODBCODBCINST.INISQL Server]
"UsageCount"=dword:00000004
"Driver"="C:\WINDOWS\SYSTEM\SQLSRV32.dll"
"Setup"="C:\WINDOWS\SYSTEM\SQLSRV32.dll"
"APILevel"="2"
"ConnectFunctions"="YYY"
"DriverODBCVer"="02.50"
"FileUsage"="0"
"SQLLevel"="1"
"CPTimeout"="60"

[HKEY_LOCAL_MACHINESoftwareODBCODBCINST.INIMicrosoft Visual FoxPro Driver]
"UsageCount"=dword:00000002
"Driver"="C:\WINDOWS\SYSTEM\vfpodbc.dll"
"Setup"="C:\WINDOWS\SYSTEM\vfpodbc.dll"
"APILevel"="0"
"ConnectFunctions"="YYN"
"DriverODBCVer"="02.50"
"DSN"="Visual FoxPro Tables"
"FileExtns"="*.dbf,*.cdx,*.idx,*.fpt"
"FileUsage"="1"
"SQLLevel"="0"
"SourceDB"=""
"SourceType"="DBF"

[HKEY_LOCAL_MACHINESoftwareODBCODBCINST.INIMicrosoft dBase VFP Driver (*.dbf)]
"UsageCount"=dword:00000001
"Driver"="C:\WINDOWS\SYSTEM\VFPODBC.DLL"
"Setup"="C:\WINDOWS\SYSTEM\VFPODBC.DLL"
"APILevel"="0"
"ConnectFunctions"="YYN"
"DriverODBCVer"="02.50"
"DSN"="dBase Files - Word"
"FileExtns"="*.dbf,*.dbc"
"FileUsage"="1"
"SQLLevel"="0"
"CPTimeout"=""
"SourceDB"=""
"SourceType"="DBF"

[HKEY_LOCAL_MACHINESoftwareODBCODBCINST.INIMicrosoft FoxPro VFP Driver (*.dbf)]
"UsageCount"=dword:00000001
"Driver"="C:\WINDOWS\SYSTEM\VFPODBC.DLL"
"Setup"="C:\WINDOWS\SYSTEM\VFPODBC.DLL"
"APILevel"="0"
"ConnectFunctions"="YYN"
"DriverODBCVer"="02.50"
"DSN"="FoxPro Files - Word"
"FileExtns"="*.dbf,*.dbc"
"FileUsage"="1"
"SQLLevel"="0"
"CPTimeout"=""
"SourceDB"=""
"SourceType"="DBF"

[HKEY_LOCAL_MACHINESoftwareODBCODBCINST.INIMS Code Page Translator]
"Translator"="C:\WINDOWS\SYSTEM\MSCPXL32.dll"
"Setup"="C:\WINDOWS\SYSTEM\MSCPXL32.dll"
"UsageCount"=dword:00000003

[HKEY_LOCAL_MACHINESoftwareODBCODBCINST.INIODBC Translators]
"MS Code Page Translator"="Installed"

[HKEY_LOCAL_MACHINESoftwareODBCODBCINST.INIMicrosoft FoxPro Driver (*.dbf)]
"UsageCount"=dword:00000001
"Driver"="C:\WINDOWS\SYSTEM\odbcjt32.dll"
"Setup"="C:\WINDOWS\SYSTEM\odfox32.dll"
"APILevel"="1"
"ConnectFunctions"="YYN"
"DriverODBCVer"="02.50"
"FileUsage"="1"
"FileExtns"="*.dbf,*.cdx,*.idx,*.ftp"
"SQLLevel"="0"
Tom Schreiner is offline   Reply With Quote
Old Apr 2nd, 2002, 10:17 AM   #10
Tom Schreiner
Board Regular
 
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
Default

User DSN's

REGEDIT4

[HKEY_CURRENT_USERSoftwareODBCODBC.INI]

[HKEY_CURRENT_USERSoftwareODBCODBC.INIODBC Data Sources]
"MS Access Database"="Microsoft Access Driver (*.mdb)"
"dBASE Files"="Microsoft dBase Driver (*.dbf)"
"Excel Files"="Microsoft Excel Driver (*.xls)"
"Visual FoxPro Database"="Microsoft Visual FoxPro Driver"
"Visual FoxPro Tables"="Microsoft Visual FoxPro Driver"
"dBase Files - Word"="Microsoft dBase VFP Driver (*.dbf)"
"FoxPro Files - Word"="Microsoft FoxPro VFP Driver (*.dbf)"

[HKEY_CURRENT_USERSoftwareODBCODBC.INIMS Access Database]
"Driver"="C:\WINDOWS\SYSTEM\ODBCJT32.DLL"
"DriverId"=dword:00000019
"SafeTransactions"=dword:00000000
"UID"=""

[HKEY_CURRENT_USERSoftwareODBCODBC.INIMS Access DatabaseEngines]

[HKEY_CURRENT_USERSoftwareODBCODBC.INIMS Access DatabaseEnginesJet]
"ImplicitCommitSync"=""
"Threads"=dword:00000003
"UserCommitSync"="Yes"

[HKEY_CURRENT_USERSoftwareODBCODBC.INIdBASE Files]
"Driver"="C:\WINDOWS\SYSTEM\ODBCJT32.DLL"
"DriverId"=dword:00000215
"SafeTransactions"=dword:00000000
"UID"=""

[HKEY_CURRENT_USERSoftwareODBCODBC.INIdBASE FilesEngines]

[HKEY_CURRENT_USERSoftwareODBCODBC.INIdBASE FilesEnginesXbase]
"ImplicitCommitSync"=""
"Threads"=dword:00000003
"UserCommitSync"="Yes"

[HKEY_CURRENT_USERSoftwareODBCODBC.INIExcel Files]
"Driver"="C:\WINDOWS\SYSTEM\ODBCJT32.DLL"
"DriverId"=dword:00000316
"SafeTransactions"=dword:00000000
"UID"=""

[HKEY_CURRENT_USERSoftwareODBCODBC.INIExcel FilesEngines]

[HKEY_CURRENT_USERSoftwareODBCODBC.INIExcel FilesEnginesExcel]
"ImplicitCommitSync"=""
"Threads"=dword:00000003
"UserCommitSync"="Yes"
"FirstRowHasNames"=hex:01

[HKEY_CURRENT_USERSoftwareODBCODBC.INIVisual FoxPro Database]
"Driver"="C:\WINDOWS\SYSTEM\VFPODBC.DLL"
"SourceDB"=""
"Description"=""
"SourceType"="DBF"
"BackgroundFetch"="Yes"
"Exclusive"="No"
"Null"="Yes"
"Deleted"="Yes"
"Collate"="MACHINE"
"SetNoCountOn"="No"

[HKEY_CURRENT_USERSoftwareODBCODBC.INIVisual FoxPro Tables]
"Driver"="C:\WINDOWS\SYSTEM\VFPODBC.DLL"
"SourceDB"=""
"Description"=""
"SourceType"="DBF"
"BackgroundFetch"="Yes"
"Exclusive"="No"
"Null"="Yes"
"Deleted"="Yes"
"Collate"="MACHINE"
"SetNoCountOn"="No"

[HKEY_CURRENT_USERSoftwareODBCODBC.INIdBase Files - Word]
"Driver"="C:\WINDOWS\SYSTEM\VFPODBC.DLL"
"SourceDB"=""
"Description"=""
"SourceType"="DBF"
"BackgroundFetch"="Yes"
"Exclusive"="No"
"Null"="Yes"
"Deleted"="Yes"
"Collate"="MACHINE"
"SetNoCountOn"="No"

[HKEY_CURRENT_USERSoftwareODBCODBC.INIFoxPro Files - Word]
"Driver"="C:\WINDOWS\SYSTEM\VFPODBC.DLL"
"SourceDB"=""
"Description"=""
"SourceType"="DBF"
"BackgroundFetch"="Yes"
"Exclusive"="No"
"Null"="Yes"
"Deleted"="Yes"
"Collate"="MACHINE"
"SetNoCountOn"="No"

Tom Schreiner is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 09:44 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes