当前位置: 首页>>代码示例>>C++>>正文


C++ otl_connect::set_connection_mode方法代码示例

本文整理汇总了C++中otl_connect::set_connection_mode方法的典型用法代码示例。如果您正苦于以下问题:C++ otl_connect::set_connection_mode方法的具体用法?C++ otl_connect::set_connection_mode怎么用?C++ otl_connect::set_connection_mode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在otl_connect的用法示例。


在下文中一共展示了otl_connect::set_connection_mode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main()
{
 otl_connect::otl_initialize(); // initialize ODBC environment
 try{

// ===================== Sybase via ODBC ======================================

  db.set_connection_mode(OTL_DEFAULT_ODBC_CONNECT);
  db.rlogon("scott/[email protected]");

  otl_cursor::direct_exec
   (
    db,
    "drop table test_tab",
    otl_exception::disabled // disable OTL exceptions
   ); // drop table

  otl_cursor::direct_exec
   (
    db,
    "create table test_tab(f1 int, f2 varchar(30))"
    );  // create table

  db.commit();

  cout<<"============== Sybase via ODBC ====================="<<endl;
  insert(10); // insert records into the table
  update(10,10); // update records in the table
  select(8,10); // select records from the table
  cout<<"===================================================="<<endl;

  db.logoff(); // disconnect from ODBC

// ===================== TimesTen via ODBC ======================================

  db.set_connection_mode(OTL_TIMESTEN_ODBC_CONNECT);
  db.rlogon("scott/[email protected]_tt1121_32");

  otl_cursor::direct_exec
   (
    db,
    "drop table test_tab",
    otl_exception::disabled // disable OTL exceptions
   ); // drop table

  otl_cursor::direct_exec
   (
    db,
    "create table test_tab(f1 int, f2 varchar(30))"
    );  // create table

  db.commit();

  cout<<"============== TimesTen via TimesTen ODBC driver ==================="<<endl;
  insert(10); // insert records into the table
  update(10,10); // update records in the table
  select(8,1); // select records from the table, 
               // stream buffer size should be set to 1 
               // when connected to TimesTen via TimesTen ODBC driver
  cout<<"===================================================================="<<endl;

  db.logoff(); // disconnect from ODBC


// ===================== MS SQL 2008 via ODBC ==============================

  db.set_connection_mode(OTL_MSSQL_2008_ODBC_CONNECT);
  db.rlogon("scott/[email protected]");

  otl_cursor::direct_exec
   (
    db,
    "drop table test_tab",
    otl_exception::disabled // disable OTL exceptions
   ); // drop table

  otl_cursor::direct_exec
   (
    db,
    "create table test_tab(f1 int, f2 varchar(30))"
    );  // create table

  db.commit();

  cout<<"=========== MS SQL 2008 via ODBC ==================="<<endl;
  insert(10); // insert records into the table
  update(10,10); // update records in the table
  select(8,10); // select records from the table
  cout<<"===================================================="<<endl;

  db.logoff(); // disconnect from ODBC

// ===================== PostgreSQL via ODBC ==============================

  db.set_connection_mode(OTL_POSTGRESQL_ODBC_CONNECT);
  db.rlogon("scott/[email protected]");

  otl_cursor::direct_exec
   (
    db,
//.........这里部分代码省略.........
开发者ID:lunar2296,项目名称:DBTest,代码行数:101,代码来源:ex675_odbc.cpp


注:本文中的otl_connect::set_connection_mode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。