Announcement Announcement Module
No announcement yet.
Getting column count and names Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting column count and names


    I'm writing an application, which will make various queries to various databases. It will get query and DB information from own DB. Column counts in queries are different. I need column count to render table of user interface. I don't know how to get column count when using query method of SimpleJdbcTemplate. In simple JDBC usage (non-Spring), it is possible to get this metadata from getMetaData method of ResultSet. Please, help to get this metadata (column count, name and datatype) using Spring JDBC.

  • #2
    Depending on which query you execute you get a List with Maps of results, the map contains as many elements as that there are columns. The list contains the amount of rows from the resultset. Everything is there why resort to the resultset.