ResultSetMetaData.getTableName(int col)don't work
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   zhebin_cong
Posted On:   Wednesday, November 19, 2003 03:32 AM

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!   More>>

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!

   <<Less

Re: ResultSetMetaData.getTableName(int col)don't work

Posted By:   Prasanna_Talakanti  
Posted On:   Saturday, November 22, 2003 06:42 AM

you'r bits of codes seem to be fine, if you paste entire code may be i can help (use "pre" when pasting code), you might already be doing but just incase try this


while(rs.next())
{
System.out.println(rset.getMetaData().getColumnCount());
System.out.println(rset.getString(1));
System.out.println(rset.getString(2));
System.out.println(rset.getMetaData().getTableName(2));
}


good luck.
About | Sitemap | Contact