script for ODBC connection

Connectivity
Enthusiast

script for ODBC connection

Hello.

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?

Thanks.

Tags (1)
9 REPLIES

Re: script for ODBC connection

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.

Enthusiast

Re: script for ODBC connection

Log file:

ODBCConf called with arguments: '/Ld debug.log configsysdsn "Teradata" "DSN = Teradata1|Description = Teradata|DBCName = Teradata"'

Data Struct:

    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'

    Actions:

        4, 'CONFIGSYSDSN', 'Teradata', 'DSN = Teradata1|Description = Teradata|DBCName = Teradata', '"Teradata" "DSN = Teradata1|Description = Teradata|DBCName = Teradata"'

EXECUTING ACTIONS

Executing Action: CONFIGSYSDSN

         arg1: 'Teradata'

         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

Junior Supporter

Re: script for ODBC connection

Hi.

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.

Cheers.

Carlos.

Enthusiast

Re: script for ODBC connection

"Component not found in the registry" where you can check out?

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?

Junior Supporter

Re: script for ODBC connection

Hi.

Just a shoot in the dark but, could it be some 64bit - 32bit issue (driver & administrator)?

Cheers.

Carlos.

Enthusiast

Re: script for ODBC connection

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.

Junior Supporter

Re: script for ODBC connection

Pavel:

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.

Poka.

Carlos.

Re: script for ODBC connection

If you are running Windows Server 2012 R2 or Windows 8.1 you may try PowerShell: https://technet.microsoft.com/en-us/%5Clibrary/Hh771022%28v=WPS.630%29.aspx

Enthusiast

Re: script for ODBC connection

Thank you. Close.