我可以从中获取表名吗
结果集元数据查询是多个表的连接
例子
从表 1、表 2 中选择 *
当我要尝试从中检索表名时
结果集元数据我总是找到空值。
注意:我正在使用informix驱动程序
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, andUPDATEstatements
SELECTstatements with more than one table name and all other statements return aStringobject containing one blank space.
From: Unsupported methods and methods that behave differently
您应该将它与列号参数一起使用,因此请尝试类似
String table1 = rs.getMetaData().getTableName(someColumnNumberFromFirstTable);
String table2 = rs.getMetaData().getTableName(someColumnNumberFromSecondTable);
另请参阅文档。