JDBC DatabaseMetaData.getColumns() returns duplicate columns

前端 未结 5 1334
南方客
南方客 2020-12-15 19:17

I\'m busy on a piece of code to get alle the column names of a table from an Oracle database. The code I came up with looks like this:

DriverManager.register         


        
5条回答
  •  青春惊慌失措
    2020-12-15 20:01

    This is the behavior mandated by the JDBC API - passing nulls as first and second parameter to getColumns means that neither catalog name nor schema name are used to narrow the search. Link to the documentation . It is true that some other JDBC drivers have different behavior by default (e.g MySQL's ConnectorJ by default restricts to the current catalog), but this is not standard, and documented as such

提交回复
热议问题