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

  • Home
  • SEARCH
  • 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 178497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:14:29+00:00 2026-05-11T14:14:29+00:00

I am using spring-2.5.6 to connect from a standalone application to an Oracle 10g

  • 0

I am using spring-2.5.6 to connect from a standalone application to an Oracle 10g database (ojdbc14.jar) using the org.apache.commons.dbcp.BasicDataSource. When I try to retrieve a SqlRowSet using the public SqlRowSet queryForRowSet(String sql, Object[] args) throws DataAccessException method I am getting an ‘java.sql.SQLException: Invalid scale size. Cannot be less than zero’.

The sql calling the table is:

select CUSTAREADESC, BEGCOL, COLLENGTH from CUSTOMERAREA where upper(trim(FLEET)) = upper(trim(?)) and CUSTAREANO = ? 

The columns BEGCOL and COLLENGTH are of the data type number with no precision defined.

I found some information on this issue, seems to be an incompatibility between the Oracle drivers and Sun’s implementation of the com.sun.rowset.CachedRowSetImpl.

Java Database Connectivity (JDBC) – Populating CachedRowSet produces SQLException: Invalid scale size

Using queryForRowSet with subquery factoring SQL gives errors

They suggest changing the sql to the following as a work around.

select CUSTAREADESC, (BEGCOL + 0) BEGCOL, (COLLENGTH + 0) COLLENGTH from CUSTOMERAREA where upper(trim(FLEET)) = upper(trim(?)) and CUSTAREANO = ? 

Does anyone know of a better generic solution that doesn’t involve custom sql for any existing table where a column doesn’t have precision defined?

  • 1 1 Answer
  • 1 View
  • 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. 2026-05-11T14:14:30+00:00Added an answer on May 11, 2026 at 2:14 pm

    I ended up creating an ResultSetExctractor class that implements ResultSetExtractor and used that to get an OracleCachedRowSet implementation of SqlRowSet. To use this you will need to include the oracle driver jar in your project (used ojdbc14.jar).

    public class SqlRowSetOracleResultSetExtractor implements ResultSetExtractor {      public Object extractData(ResultSet rs) throws SQLException {         return createSqlRowSet(rs);     }      protected SqlRowSet createSqlRowSet(ResultSet rs) throws SQLException {         CachedRowSet rowSet = newCachedRowSet();         rowSet.populate(rs);         return new ResultSetWrappingSqlRowSet(rowSet);     }      protected CachedRowSet newCachedRowSet() throws SQLException {         return new OracleCachedRowSet();     } } 

    This is then used by in the following way to extract a SqlRowSet.

    SqlRowSet rs = (SqlRowSet) this.jdbcTemplate.query(SELECT_CUSTOMER_AREA,                 new Object[]{new SqlParameterValue(Types.VARCHAR, companyId),                 new SqlParameterValue(Types.NUMERIC, areaNumber)},                 new SqlRowSetOracleResultSetExtractor()); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I am trying to connect Oracle 10g(Source/Target) from ssis using connection string as
We are currently using Spring JDBC with connection pool implementation from DBCP to connect
I'm trying to connect to an Active Directory from Activiti, using Apache Directory's LDAP
I want to connect to the access 2010 database from excel.I am using VBA.I
I'm using JaxWsPortProxyFactoryBean in Spring to connect a SOAP webservice. The problem is that
I am using Spring Forms for my web application. For nested properties, the form
I am using JDBC to connect to MySQL for a small application. In order
I am trying to connect to a mysql database on my first Spring Project
I would like to connect to a DB2 database, specifically an iSeries version, using
I'm trying to connect to a SQL Server database using JDBC, the database I'm

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.