Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

oracle 11g resultSet how to get the table name

I found there is some problem in Oracle 11g to get table name from interface(ResultSet.getMetaData().getTableName(int column));

It always show the empty string.

Is there something wrong for oracle database or jdbc driver? If the jdbc driver's problem , Can I get another jdbc driver to resolve this issue?

Thanks in advance!

like image 268
eingmarra Avatar asked Dec 18 '13 09:12

eingmarra


People also ask

How do I get a list of column names in ResultSet?

You can get the name of a particular column using the getColumnName() method of the ResultSetMetadata interface. This method accepts an integer value representing the index of a column and returns a String value representing the name of the specified column.

What is ResultSet getString ()?

Retrieves the Statement object that produced this ResultSet object. String. getString(int columnIndex) Retrieves the value of the designated column in the current row of this ResultSet object as a String in the Java programming language.

How can we view a ResultSet?

The ResultSet interface declares getter methods (for example, getBoolean and getLong ) for retrieving column values from the current row. You can retrieve values using either the index number of the column or the alias or name of the column. The column index is usually more efficient. Columns are numbered from 1.


1 Answers

According to the documentation this is not supported:

but does not implement the getSchemaName and getTableName methods because Oracle Database does not make this feasible

Earlier Oracle drivers did have this feature, but it needed to be enabled explicitly because of its performance implications. As far as I can tell from the documentation this is no longer available in more recent drivers.

like image 199
Mark Rotteveel Avatar answered Oct 13 '22 01:10

Mark Rotteveel