大家好,刚发了个帖子,发现有点错误,不好意思
我遇到的这个问题就是在注释那一行,如果用getInt(1)的话,运行后会出现这样的情况:(能全部查的出来,但是后面会有那个表不存在的错误,晕)
-------------
id: 2
-------------
id: 1
-------------
id: 3
-------------
id: 4
-------------
id: 2
Error running the demo: ORA-00942: table or view does not exist如果用getString(2)的话,程序运行一半查出两行后就会报错:
-------------
summary: abcdefg
-------------
summary: bbbbb
*** glibc detected *** double free or corruption (out): 0x0000000000591050 ***
Aborted
请问哪位大虾能帮帮我,怎么解决这两个问题?急哦!!!!!!!!!!!!!局部代码如下:
void displayAllRows ()
{
cout << "Displaying all the rows of the table" << endl;
stmt = conn->createStatement (
"SELECT id,summary FROM book"); journal c2; ResultSet *rs = stmt->executeQuery();
try{
while (rs->next())
{
cout <<"-------------"<<endl;
cout << "id: " << rs->getInt(1) << endl;
// cout << "summary: "<< rs->getString(2)<<endl;;
}
}catch(SQLException ex)
{
cout<<"Exception thrown for displayRow"<<endl;
cout<<"Error number: "<< ex.getErrorCode() << endl;
cout<<ex.getMessage() << endl;
}
stmt->closeResultSet (rs);
conn->terminateStatement (stmt); }
我遇到的这个问题就是在注释那一行,如果用getInt(1)的话,运行后会出现这样的情况:(能全部查的出来,但是后面会有那个表不存在的错误,晕)
-------------
id: 2
-------------
id: 1
-------------
id: 3
-------------
id: 4
-------------
id: 2
Error running the demo: ORA-00942: table or view does not exist如果用getString(2)的话,程序运行一半查出两行后就会报错:
-------------
summary: abcdefg
-------------
summary: bbbbb
*** glibc detected *** double free or corruption (out): 0x0000000000591050 ***
Aborted
请问哪位大虾能帮帮我,怎么解决这两个问题?急哦!!!!!!!!!!!!!局部代码如下:
void displayAllRows ()
{
cout << "Displaying all the rows of the table" << endl;
stmt = conn->createStatement (
"SELECT id,summary FROM book"); journal c2; ResultSet *rs = stmt->executeQuery();
try{
while (rs->next())
{
cout <<"-------------"<<endl;
cout << "id: " << rs->getInt(1) << endl;
// cout << "summary: "<< rs->getString(2)<<endl;;
}
}catch(SQLException ex)
{
cout<<"Exception thrown for displayRow"<<endl;
cout<<"Error number: "<< ex.getErrorCode() << endl;
cout<<ex.getMessage() << endl;
}
stmt->closeResultSet (rs);
conn->terminateStatement (stmt); }
解决方案 »
- 求一条SQL语句的优化
- Oracle客户端 - Oracle SQL Handler(超方便实用且免费,能运行于 Windows 7、Linux、Mac)
- oracle中能不能实现存储“数组”?
- 请教一个sql语句
- 全文索引建立的JOB可以成功执行但却不起作用?
- VC如何链接到Oracale数据库啊?(送分。。)(只要执行简单的insert, delete update操作)
- Pro*C中使用动态sql定义了两个游标,为什么第2个游标内容取不出来!!
- 关于系统表的问题(重要级别 ***** )
- 什么是“监听器”?
- 新手提问:连接不上oracle sql developer
- 搞ORACLE开发有前途么?
- ora-00918 未明确定义列
getInt(1) 就是 getInt("id")
getString(2) 就是 getString("summary")
2种写法是一样的。能出结果就不该有错的。你把sql换张表再试下,看是否同样错误,可能程序有错
看代码,似乎没什么问题,倒像是你的环境出了问题。看看是不是glibc与Oracle OCCI要求的版本不一致。