Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8182009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:42:53+00:00 2026-06-07T00:42:53+00:00

I am using the Spring JdbcUtils.extractDatabaseMetaData() method to analyze the database. The function calls

  • 0

I am using the Spring JdbcUtils.extractDatabaseMetaData() method to analyze the database. The function calls a callback and hands over a DatabaseMetaData object. This object provides the getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern).

I call it like this getColumns("",TABLE_OWNER_USERNAME,null,null) and get 400 columns as a result. These are exactly the results that I want, but the request takes over 1 minute.

Can I somehow optimize this query to be fast? Pulling 400 rows should happen in 1 seconds and not one minute.

EDIT: I don’t suspect the Spring part being slow. Closer analysis showed that fetching the DatabaseMetaData takes a few seconds butexecuting the getColumns() takes really long.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T00:42:55+00:00Added an answer on June 7, 2026 at 12:42 am

    Maybe it’s a better approach to query ALL_TAB_COLUMNS. Here is an example:

    public final List<Column> getColumnsByOwner(final String owner) {
        final String sql = "SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH, "
                + " DATA_PRECISION, DATA_SCALE, NULLABLE, DATA_DEFAULT"
                + " FROM ALL_TAB_COLUMNS"
                + " WHERE OWNER = ? ORDER BY COLUMN_ID";
    
        return jdbcTemplate.query(sql,
                new Object[] { owner },
                new RowMapper<Column>() {
                    @Override
                    public Column mapRow(final ResultSet res, final int rowNum)
                            throws SQLException {
                        final Column reg = new Column();
    
                        reg.setColumnName(res.getString("COLUMN_NAME"));
                        //Read other properties
                        reg.setNullable(res.getString("NULLABLE").equals("Y"));
                        return reg;
                    }
                });
    }
    

    If you need to filter by table simply add ” AND TABLE_NAME = ?” to sql and tableName as another parameter.

    Hope it helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Spring/SpringMVC 3.0.5 I've defined a method in my controller like this: @RequestMapping(params =
Hi I am using spring jdbctemplate to invoke an oracle function which takes an
I'm using Spring-Data-JPA 1.0.3.RELEASE to manage my ORM. my persistence.xml looks like this: <persistence>
For using spring request scope bean is this definition correct? <bean id=shoppingCart class=ShoppingCart scope=request>
I am using spring's ContentNegotiatingViewResolver in order to export data to excel files. This
I am using spring 3 and I tried to add exception mapping this way:
Using Spring MVC, I have this Controller class: @Controller public class LoginController { @Autowired
Using Spring 3.0.x, I'm running into an issue where a Bean init-method is running,
Using Spring 2.5 tag library, I have an Integer value in a command form
When using spring security, specifically with @notation; what is the proper way to access

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.