Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why it don't work?

 
zb cong
Ranch Hand
Posts: 416
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello
i write a sql clause-"select * from emp",and want to connect to oracle database(scott/tiger) in my java programmer,after it is executed,the resultset(rset) can be returned correctly,then i invoke following clause:

rset.next();
System.out.println(rset.getString(2));
System.out.println(rset.getMetaData().getTableName(2));

the first clause can return the correct result("smith"),but the second clause return the empty string(" "),the correct result should be "emp".even i change to use the OracleConnection,OracleStatement and OracleResultSet,it still don't work,why?who can help me,and how can i return the table name that the column belong to?

thank you!
 
Wayne L Johnson
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried this and got the same results as you. So I did a little searching on the intenet and found the following on Oracle Technology Network :

OracleResultSetMetaData interface does not implement the getSchemaName() and getTableName() methods because underlying protocol does not make this feasible.

So as long as you use the THIN driver it seems you're out of luck ..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic