ResultSetMetaData.getTableName(int column) don't work?

Discussions

General J2EE: ResultSetMetaData.getTableName(int column) don't work?

  1. ResultSetMetaData.getTableName(int column) don't work? (1 messages)

    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!
  2. Your already know the table name is emp??
    There are also some tables in Oracle that stores table names and object names

    EX: select * from user_tables