Computing.Net > Forums > Database > Hidden ODBC DSN although in Registr

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Hidden ODBC DSN although in Registr

Reply to Message Icon

Name: Obfuscated
Date: September 19, 2008 at 11:22:49 Pacific
OS: XP SP2
CPU/Ram: 1GB
Product: Dell
Comment:

I have not yet determined how this occurs but when the following value is blank, all of the existing ODBC configurations become COMPLETELY HIDDEN from the user –- whether using the ODBCAD32.exe tool or when any application prompts the user with a list of pre-configured ODBC connections that truly do exist on their local computer.

1. Open REGEDIT.exe
2. Navigate to HKLM > SOFTWARE > ODBC > ODBC.INI > ODBC Data Sources
3. In the right pane, the entry "(Default)" has a Data value of blank.

I am able to manually resolve this issue:
1. Simply right-click the "(Default)" entry and choose delete. After confirming deletion, the system will immediately recreate that REG_SZ entry ... only this time properly setting its value to "(value not set)".
2. Refresh the ODBCAD32.exe window and all of the ODBC configured connections reappear.

This occurs on many of our machines running WinXP SP2.

I would like to be able to automate the correcting (change or delete) of this registry value, using WSH scripting, but I do not know how to manipulate that particular entry. Any suggestions?

Thanks!



Sponsored Link
Ads by Google

Response Number 1
Name: Obfuscated
Date: September 19, 2008 at 20:42:41 Pacific
Reply:

If you delete the ODBC Data Sources entry from the registry, it will be recreated at the time a child is added to the registry as such:

Option Explicit

Dim WSHShell_hacks
Set WSHShell_hacks = WScript.CreateObject("WScript.Shell")

' =================================================================================================
' MASTER ODBC that, when value is not "(value not set)", will hide all of the ODBC from the viewer.
' By deleting it first, it will be auto-created when the first child is written AND will have the
' proper value of "(value not set)" for this master entry.
' =================================================================================================
WSHShell_hacks.RegDelete "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources\"

' =========================================================================
' Establish ODBC configuration as system DSN for SOME_SQL_DB:
' =========================================================================
WSHShell_hacks.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources\sysdsn_some_sql_db", "SQL Server", "REG_SZ"

WSHShell_hacks.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\sysdsn_some_sql_db\Database", "some_sql_db", "REG_SZ"

WSHShell_hacks.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\sysdsn_some_sql_db\Description", "some database", "REG_SZ"

WSHShell_hacks.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\sysdsn_some_sql_db\Driver", "C:\Windows\system32\SQLSRV32.dll", "REG_SZ"

WSHShell_hacks.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\sysdsn_some_sql_db\Server", "10.10.5.100\instance_name", "REG_SZ"

WSHShell_hacks.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\sysdsn_some_sql_db\Trusted_Connection", "Yes", "REG_SZ"

Set WSHShell_hacks = Nothing



0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Database Forum Home


Sponsored links

Ads by Google


Results for: Hidden ODBC DSN although in Registr

Command line ODBC Driver Add? www.computing.net/answers/dbase/command-line-odbc-driver-add/62.html

DataSource change when not in admin www.computing.net/answers/dbase/datasource-change-when-not-in-admin/19.html

Problems with ODBC (SQL) www.computing.net/answers/dbase/problems-with-odbc-sql/302.html