Aslan Valued Contributor


Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Thu Jan 19, 2012 3:09 am Post subject: |
|
|
Works for me on Win 7 x64 and Server 2008 R2
Consider the following code in lue of using odbc32.exe on a 64bit Windows system.
| Code: | # %%DSN = Connection Name
# %%UID = User Name that can access the DB or DBQ
# IF SQL
# %%DBDescr = What this connection is for
# %%DBServer = SQL Server name
# %%DBName = Name of DB on SQL Server
# IF MS Access
# %%DBQ = Full path to Access file
# Use for SQL Server
runh reg add HKLM\Software\Wow6432Node\ODBC\ODBC.INI\%%DSN /v Driver /t REG_SZ /d @windir(S)\sqlsrv32.dll /f
runh reg add HKLM\Software\Wow6432Node\ODBC\ODBC.INI\%%DSN /v Description /t REG_SZ /d %%DBDescr /f
runh reg add HKLM\Software\Wow6432Node\ODBC\ODBC.INI\%%DSN /v Server /t REG_SZ /d %%DBserver /f
runh reg add HKLM\Software\Wow6432Node\ODBC\ODBC.INI\%%DSN /v Database /t REG_SZ /d %%DBName /f
runh reg add HKLM\Software\Wow6432Node\ODBC\ODBC.INI\%%DSN /v Regional /t REG_SZ /d No /f
runh reg add HKLM\Software\Wow6432Node\ODBC\ODBC.INI\%%DSN /v Trusted_Connection /t REG_SZ /d No /f
runh reg add HKLM\Software\Wow6432Node\ODBC\ODBC.INI\%%DSN /v LastUser /t REG_SZ /d %%UID /f
runh reg add @chr(34)HKLM\Software\Wow6432Node\ODBC\ODBC.INI\ODBC Data Sources@chr(34) /v %%DSN /t REG_SZ /d @chr(34)SQL Server@chr(34) /f
# Use for MS Access
runh reg add HKLM\Software\Wow6432Node\ODBC\ODBC.INI\%%DSN /v Driver /t REG_SZ /d @windir(S)\odbcjt32.dll /f
runh reg add HKLM\Software\Wow6432Node\ODBC\ODBC.INI\%%DSN /v DBQ /t REG_SZ /d %%DBQ /f
runh reg add HKLM\Software\Wow6432Node\ODBC\ODBC.INI\%%DSN /v DriverId /t REG_DWORD /d 00000000 /f
runh reg add HKLM\Software\Wow6432Node\ODBC\ODBC.INI\%%DSN /v SafeTransactions /t REG_DWORD /d %%DBName /f
runh reg add HKLM\Software\Wow6432Node\ODBC\ODBC.INI\%%DSN /v UID /t REG_SZ /d %%UID /f
runh reg add HKLM\Software\Wow6432Node\ODBC\ODBC.INI\%%DSN\Engines
runh reg add HKLM\Software\Wow6432Node\ODBC\ODBC.INI\%%DSN\Engines\Jet /v Threads /t REG_DWORD /d 00000003 /f
runh reg add HKLM\Software\Wow6432Node\ODBC\ODBC.INI\%%DSN\Engines\Jet /v UserCommitSync /t REG_SZ /d Yes /f
runh reg add @chr(34)HKLM\Software\Wow6432Node\ODBC\ODBC.INI\ODBC Data Sources@chr(34) /v %%DSN /t REG_SZ /d @chr(34)"Microsoft Access Driver (*.mdb)"@chr(34) /f
# Now you should be able to connect to your DB
# If using vdsdb.dll
db connect,%%DSN,%%UID,%%PWD
# or if using all-in-one vdsdll.dll
dll db,connect,%%DSN,%%UID,%%PWD |
I know this can be done using the VDS command "Registry Write" but when I originally developed this it was for remote registry purposes i.e
| Code: | runh reg add \\%%ComputerName\HKLM\Software\Wow6432Node\ODBC\ODBC.INI\%%DSN /v Driver /t REG_SZ /d @windir(S)\sqlsrv32.dll /f
|
Hope this was some help to you
I use the vdsdb.dll extensively so feel free PM me if you need assistance |
|