Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Configure ODBC driver using VBScript

Status
Not open for further replies.

xitu

Technical User
Oct 1, 2003
55
US
Does anyone know how to include the User Name in the ODBC driver by using the following code??

Thanks,

Code:
set WshShell = wscript.createObject( "WScript.Shell" )
const ODBC = "HKLM\SOFTWARE\ODBC\ODBC.INI\"

sName = "Name"
sServer = "Server"
sDesc = "Description"
sUser = "UserName"


  dim ODBCS
  ODBCS = ODBC & sName & "\"
  WshShell.regWrite ODBC, sName
  WshShell.regWrite ODBC & "ODBC Data Sources\" & sName, "Microsoft ODBC for Oracle"
  WshShell.regWrite ODBCS & "Driver", "C:\WINNT\System32\sqlsrv32.dll"
  WshShell.regWrite ODBCS & "Description", sDesc
  WshShell.regWrite ODBCS & "User Name", sUser ' Does not work. Tried LastUser but no help.
  WshShell.regWrite ODBCS & "Server", sServer

set WshShell = Nothing
 
Have you created an Oracle DSN with the ODBC manager and then looked with regedit in the registry to discover what and where regWriting ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I would try:

Code:
set WshShell = wscript.createObject( "WScript.Shell" )
const ODBC = "HKLM\SOFTWARE\ODBC\ODBC.INI\"

sName = "Name"
sServer = "Server"
sDesc = "Description"
sUser = "UserName"


  dim ODBCS
  ODBCS = ODBC & sName & "\"
  WshShell.regWrite ODBC, sName
  WshShell.regWrite ODBC & "ODBC Data Sources\" & sName, "Microsoft ODBC for Oracle"
  WshShell.regWrite ODBCS & "Driver", "C:\WINNT\System32\sqlsrv32.dll"
  WshShell.regWrite ODBCS & "Description", sDesc
  WshShell.regWrite ODBCS & "[red]UserId[/red]", sUser ' Does not work. Tried LastUser but no help.
  WshShell.regWrite ODBCS & "Server", sServer

set WshShell = Nothing

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
I got it. The answer was
Code:
WshShell.regWrite ODBCS & "UID", sUser

Thanks,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top