Often it is necessary to create a connection to the Teradata database and want to automate this process.
Use teradata ODBC Driver 13.10.00.01
I tried to bat files through the following:
% WINDIR% \ System32 \ odbcconf.exe configsysdsn "Teradata" "DSN = Teradata1 | Description = Teradata | DBCName = Teradata"
Gives an error message:
CONFIGSYSDSN: Unable to create a data source for the 'Teradata' driver:
Component not found in the registry with error code -2147467259
Advise how you can create?
The error suggests that you do not have Teradata ODBC driver installed properly.
One thing you can do is to run the odbcconf.exe with debug logging enabled to get more details:
% WINDIR% \ System32 \ odbcconf.exe /Ld debug.log configsysdsn "Teradata" "DSN = Teradata1 | Description = Teradata | DBCName = Teradata"
Then post the debug.log file contents here.
ODBCConf called with arguments: '/Ld debug.log configsysdsn "Teradata" "DSN = Teradata1|Description = Teradata|DBCName = Teradata"'
Reboot First : 0
Use Response File : 0
Response File : '(null)'
Erase Response File: 0
Silent : 0
Continue on Error : 0
Log Mode : 3
Log File : 'debug.log'
4, 'CONFIGSYSDSN', 'Teradata', 'DSN = Teradata1|Description = Teradata|DBCName = Teradata', '"Teradata" "DSN = Teradata1|Description = Teradata|DBCName = Teradata"'
Executing Action: CONFIGSYSDSN
arg2: 'DSN = Teradata1|Description = Teradata|DBCName = Teradata'
args: '"Teradata" "DSN = Teradata1|Description = Teradata|DBCName = Teradata"'
CONFIGSYSDSN About to Load the ODBC Control Panel (odbccp32.dll)
CONFIGSYSDSN ODBC Control panel (odbccp32.dll) HINSTANCE: -345178112
CONFIGSYSDSN SQLConfigDataSource ProcAddress: -345082832
CONFIGSYSDSN Unable to create a data source for the 'Teradata' driver:
Компонент не найден в реестре
CONFIGSYSDSN ODBC Control Panel (odbccp32.dll) freed using CoFreeLibrary
Return HR: 0x80004005
Error Executing Action: CONFIGSYSDSN
Unable to create a data source for the 'Teradata' driver:
Компонент не найден в реестре with error code -2147467259
The error message "Komponent ne nayden v reyestre" (Component not found in the registry) should give you an idea... Something wrong with the TD odbc install, as said before.
If you create a connection using the "ODBC Data Source Administrator", then everything is working correctly. But we want to configure the connection through a script. Maybe you need something extra to register when create?
I'm use 32bit ODBC, but system 64 bit.
Maybe there is better way to automate the creation of the connection from the user? without using odbcconf.exe.
Actually, in 64 bit Windows there are two different ODBC configurators(odbcconf.exe), one for 64 bit ODBC drivers (the 'default' one, which is, ironically, in Windows\SYSTEM32) and one for 32 bit ODBC drivers (this is in Windows\SysWOW64).
Check your installation to see which one you should be using.
If you are running Windows Server 2012 R2 or Windows 8.1 you may try PowerShell: https://technet.microsoft.com/en-us/%5Clibrary/Hh7