问题描述:

In my database I have tables "EMPLOYEE_DETAILS" and "EMPLOYEE DETAILS" with different columns for both tables. When I used the getColumns() method of the DatabaseMetaData (java.sql.DatabaseMetaData) to get the column details of the table "EMPLOYEE_DETAILS", I am getting the columns of both "EMPLOYEE_DETAILS" and "EMPLOYEE DETAILS".

I have tried this for databases Oracle, MySql and MSSQL. The result is same.

The code which I have used to call the getColumns method is given below :

String tableName = "EMPLOYEE_DETAILS";

ResultSet columnResultSet = databaseMetaData.getColumns(null, null,tableName, null);

while (columnResultSet.next()) {

System.out.println(columnResultSet.getString("COLUMN_NAME"));

System.out.println(columnType = columnResultSet.getString("TYPE_NAME"));

System.out.println(columnSize = columnResultSet.getInt("COLUMN_SIZE"));

}

Could anyone please help me to resolve this.

相关阅读:
Top