打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Step 1. Connecting to database (and error handling)
#include <stdio.h>  // for printf#include <SQLAPI.h> // main SQLAPI++ headerint main(int argc, char* argv[]){    SAConnection con; // create connection object        try    {        // connect to database        // in this example it is Oracle,        // but can also be Sybase, Informix, DB2        // SQLServer, InterBase, SQLBase and ODBC        con.Connect(            "test",     // database name            "tester",   // user name            "tester",   // password            SA_Oracle_Client);        printf("We are connected!\n");        // Disconnect is optional        // autodisconnect will ocur in destructor if needed        con.Disconnect();        printf("We are disconnected!\n");    }    catch(SAException &x)    {        // SAConnection::Rollback()        // can also throw an exception        // (if a network error for example),        // we will be ready        try        {            // on error rollback changes            con.Rollback();        }        catch(SAException &)        {        }        // print error message        printf("%s\n", (const char*)x.ErrText());    }        return 0;}
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
SQL 事务的两种用法
Error 2068 trapped in 2PC on transaction 21.3...
Fatal error: Uncaught Error: Call to undefined function mysql
MySQL 连接测试
【绘本世界】不能错过的经典英文有声绘本 Dry Bones
Too Much Collaboration, Too Little Time to Think: Managing Your Interruptions
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服