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 7816679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:57:17+00:00 2026-06-02T05:57:17+00:00

Our Java (JDK6) application must support different databases, such as Oracle, SQL Server and

  • 0

Our Java (JDK6) application must support different databases, such as Oracle, SQL Server and DB2. We use Spring 3.0 and JDBCTemplate for database access. One of our clients uses SQL Server 2005 with case sensitivity and automatically upper cases table names.

Obviously, queries such as “select * from mytablename m” do not work for said client, as he would have the table MYTABLENAME.

For the following code, for instance, I get a nice exception:

this.jdbcTemplate.queryForOject("select * from mytablename m");
`Exception in thread "main" org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [select * from mytablename m]; nested exception is java.sql.SQLException: Invalid object name 'mytablename'.`

I’m stuck with having to adapt the code – since I can’t change my client’s database options – so the most obvious solution would be to upper case all the table names in our queries. I know that’ll work for this client, but what if a new client has a database with case sensitivity and lower case table names?

So far I haven’t succeeded in finding a broader solution. Most answers I’ve found required changing the database’s case-sensitivity or rewriting the queries. I’ve tried using: this.jdbcTemplate.setResultsMapCaseInsensitive(true); but if I understood well, it applies only to the results of my query, not the query itself.

Is there a way to execute a case-insensitive query using Spring’s JdbcTemplate?

  • 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-02T05:57:22+00:00Added an answer on June 2, 2026 at 5:57 am

    If you are supporting a large number of databases you might find more problems than just case sensitive names. This is a great opportunity to stress the importance of abstracting your data access with an interface, and writing implementations for each supported database vendor.

    In your app you should code to the interface. As you are using spring you can use dependency injection to use the appropriate DB implementation in your data access layer; its just a trivial change to the application context configuration file.

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

Sidebar

Related Questions

Our Java application has about 100 classes mapped to a database (SQL Server or
We use Tomcat for our java web application. There is a properties file under
We are extending our java application to support plugins. Part of that includes keeping
We use spring to construct/inject our java beans. Here a snippet: <bean id=myAppConfigs class=my.cool.webapp.ApplicationConfig
Can anyone suggest a good validation framework we can use in our java application?
I've been assigned the task of making our Java web application work with Oracle
Our Java application has a number of modules which implement a common interface. By
Currently our Java application uses the values held within a tab delimited *.cfg file.
Part of our java application needs to run javascript that is written by non-developers.
On one of our Java application screens, we want to display data loaded from

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.