本文整理汇总了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,
//.........这里部分代码省略.........