Usuário com melhor resposta
Criar entrada DSN ODBC - Auxilio para adaptar script.

Pergunta
-
Pessoal,
Encontrei na internet um script que cria uma entrada DSN para acesso via ODBC. Após incluir duas entradas (senha e chave Data Sources), o script esta quase pronto, resta apenas, de algum modo, remover a flag que altera o banco de dados padrão, cujo texto original é "Alterar o banco de dados padrão para:". Sempre que utilizo o script, essa opção fica ativada e o nosso aplicativo não conecta.
Alguém sabe como posso remover essa característica? Já procurei no script e não achei nada relacionado. Se ao menos eu soubesse como pesquisar os parâmetros possíveis, eu iria estudar um a um, mas não faço idéia de onde o criador do script (que pelo post é antigo) obteve os parâmetros.
Segue script a ser adaptado, grato.
'*************************************************************** '***** '***** This script creates a DSN for connecting to a '***** SQL Server database. To view errors comment out line 16 '***** '***** Script Name: AutoDSN.vbs '***** Author: Darron Nesbitt '***** Depends: VBScript, WScript Host '***** Created: 10/2/2001 '***** '*************************************************************** 'Values for variables on lines 25 - 29, 32, and 36 'must be set prior to running this script. On Error Resume Next Dim RegObj Dim SysEnv Set RegObj = WScript.CreateObject("WScript.Shell") '***** Specify the DSN parameters ***** DataSourceName = "BASETESTE" DatabaseName = "BASETESTE" Description = "BASETESTE - Repositorio" LastUser = "LOGIN" Server = "SERVIDOR\BASETESTE" 'if you use SQL Server the driver name would be "SQL Server" DriverName = "SQL Server" 'Set this to True if Windows Authentication is used 'else set to False or comment out WindowsAuthentication = False 'point to DSN in registry REG_KEY_PATH = "HKLM\SOFTWARE\ODBC\ODBC.INI\" & DataSourceName ' Open the DSN key and check for Server entry lResult = RegObj.RegRead (REG_KEY_PATH & "\Server") 'if lResult is nothing, DSN does not exist; create it if lResult = "" then 'get os version through WSCript Enviroment object Set SysEnv = RegObj.Environment("SYSTEM") OSVer = UCase(SysEnv("OS")) 'check which os is running so correct driver path can be set Select Case OSVer Case "WINDOWS_NT" DrvrPath = "C:\WinNT\System32" Case Else DrvrPath = "C:\Windows\System" End Select 'create entries in registry RegObj.RegWrite REG_KEY_PATH & "\DataBase",DatabaseName,"REG_SZ" RegObj.RegWrite REG_KEY_PATH & "\Description",Description,"REG_SZ" RegObj.RegWrite REG_KEY_PATH & "\LastUser",LastUser,"REG_SZ" RegObj.RegWrite REG_KEY_PATH & "\Server",Server,"REG_SZ" RegObj.RegWrite REG_KEY_PATH & "\Driver",DrvrPath,"REG_SZ" RegObj.RegWrite REG_KEY_PATH & "\PWD",SENHA,"REG_SZ" 'if WindowsAuthentication set to True, 'a trusted connection entry is added to registry 'else, SQL Authentication is used. if WindowsAuthentication = True then RegObj.RegWrite REG_KEY_PATH & "\Trusted_Connection","Yes","REG_SZ" end if 'point to data sources key REG_KEY_PATH = "HKLM\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources\" & DataSourceName RegObj.RegWrite REG_KEY_PATH & "\BASETESTE","SQL Server","REG_SZ" 'and add the name of the new dsn and the driver to use with it RegObj.RegWrite REG_KEY_PATH,DriverName,"REG_SZ" MsgBox DataSourceName & " DSN Created!" else MsgBox DataSourceName & " DSN already exists!" end if Set RegObj = Nothing Set SysEnv = Nothing '*************************************************************** ' END AutoDSN.txt '***************************************************************
Respostas
-
Na linha onde vc informa o database, informe como vazio:
DataSourceName = "BASETESTE"
DatabaseName = ""
Description = "BASETESTE - Repositorio"
LastUser = "LOGIN"
Server = "SERVIDOR\BASETESTE"
Fábio de Paula Junior- Marcado como Resposta Edson S Freitas segunda-feira, 13 de setembro de 2010 20:09
Todas as Respostas
-
Na linha onde vc informa o database, informe como vazio:
DataSourceName = "BASETESTE"
DatabaseName = ""
Description = "BASETESTE - Repositorio"
LastUser = "LOGIN"
Server = "SERVIDOR\BASETESTE"
Fábio de Paula Junior- Marcado como Resposta Edson S Freitas segunda-feira, 13 de setembro de 2010 20:09
-
-