0

我可以从中获取表名吗

结果集元数据
查询是多个表的连接

例子

从表 1、表 2 中选择 *

当我要尝试从中检索表名时

结果集元数据
我总是找到空值。

注意:我正在使用informix驱动程序

4

2 回答 2

1

Based on the Informix JDBC Guide, the driver is unable to retrieve the tablename if the query accesses more than one table and will return a single space instead:

ResultSetMetaData.getTableName()

Returns the table name for SELECT, INSERT, and UPDATE statements

SELECT statements with more than one table name and all other statements return a String object containing one blank space.

From: Unsupported methods and methods that behave differently

于 2013-10-07T12:23:43.080 回答
0

您应该将它与列号参数一起使用,因此请尝试类似

String table1 = rs.getMetaData().getTableName(someColumnNumberFromFirstTable);    
String table2 = rs.getMetaData().getTableName(someColumnNumberFromSecondTable);

另请参阅文档

于 2013-10-07T12:13:32.317 回答