All Forums Tools
Tuen 44 posts Joined 07/05
05 Dec 2012
Examples of writing prepared statements in CLIv2

We have a development group wanting to convert a C++ program that uses CLI for sybase to using Teradata's CLIv2.  One of things we are having problems finding information on is how to construct a prepared statement in the CLIv2 code.  Would anyone have an sample that they would be willing to share?  There doesn't appear to be much documentation on writing progams using CLIv2 like you can find with JDBC or even ODBC.

tomnolan 594 posts Joined 01/08
06 Dec 2012

Please consider using the Teradata ODBC Driver for a C or C++ program that uses prepared statements.
Prepared statements are tested extensively with Teradata's industry standard data access API products -- the Teradata JDBC Driver, ODBC Driver, and the .NET Data Provider.
However, I'm not aware of any testing done for prepared statements with CLIv2.

Tuen 44 posts Joined 07/05
07 Dec 2012

They are using a C++ program which currently uses the Sybase CLI and they want to switch it out for Teradata CLI.  We don't have an the option to use ODBC in this case.  If they can't use the CLI then they will shift their application to a different platform that can use CLI and not use Teradata.  Everything they want to do should be able to be done with Teradata's CLI, however, there isn't any good documentation on how to do certain things.  The only documentation provided by Teradata doesn't really have much in the way of examples. 

tomnolan 594 posts Joined 01/08
07 Dec 2012

Sybase's original proprietary connectivity library was DB-Library, and it has been superseded by CT-Library.
Each database vendor's proprietary connectivity library is typically quite different from those of other vendors. The only exception to this is DB-Library for Sybase versus Microsoft SQL Server, because Microsoft SQL Server was originally derived from Sybase.
Teradata CLIv2 is quite different from Sybase's DB-Library or CT-Library, and it would be a significant amount of work to port an application that uses DB-Library or CT-Library to use Teradata CLIv2 instead. It's certainly NOT a drop-in replacement.
In all honesty, I would strongly recommend converting such an application to use an industry-standard API such as ODBC. It's hard to see any benefit to using proprietary connectivity libraries, because the application must be rewritten in order to switch databases.

tomnolan 594 posts Joined 01/08
12 Dec 2012

Appendix A of the Network CLIv2 Reference manual contains section titled "Sending a Parameterized SQL Using APH Defined Extension Elements" which lists an example C program that executes a query with a question-mark parameter marker.
The Network CLIv2 Reference manual is available for download here:

Tuen 44 posts Joined 07/05
17 Dec 2012

Thanks Tom, will have the developer look at that sample as well as start exploring the feasbility to switch to ODBC.

You must sign in to leave a comment.