64,661
社区成员
发帖
与我相关
我的任务
分享
try{
Environment *env=Environment::createEnvironment(Environment::OBJECT);
Connection *conn = env->createConnection(username,password,constr);
cout<<"hello world..."<<endl;
Statement *stmt = conn->createStatement("Select id, name from yqys");
ResultSet *rs = NULL;
rs = stmt->executeQuery();
string abc;
while(rs->next())
{
//cout<<rs->getStream(1)<<endl;
cout<<rs->getString(2)<<endl;
cout<<rs->getString(3);
}
conn->terminateStatement(stmt);
env->terminateConnection(conn);
Environment::terminateEnvironment(env);
}catch(SQLException excp){
std::cout <<"exception:" <<excp.what()<<endl;
}