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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:03:58+00:00 2026-05-11T17:03:58+00:00

This one has me stumped. I’ve got a java.sql.ResultSet and I’m pulling string values

  • 0

This one has me stumped.

I’ve got a java.sql.ResultSet and I’m pulling string values out of it like so:

address.setAddressLine1(rs.getString("AddressLine1"));
address.setAddressLine2(rs.getString("AddressLine2"));

When I debug and inspect rs.getString(“AddressLine1”), the debugger says I’ve got a 30 character string: “ATTN: ACCOUNTS PAYABLE” (trailing spaces removed). However, when I inspect my address object immediately after this line, it’s reporting that addressLine1 is a 30 character string of spaces or some other whitespace.

When I debug and inspect rs.getString(“AddressLine2”), the debugger says that I’ve got a 23 character string: “10 Something Street” (trailing spaces removed). When I inspect my address object immediately after this line, it’s reporting addressLine2 is null.

What’s really driving me nuts is that this isn’t happening with every value, only a few.

My address class is storing plain old strings with totally dumb getters and setters. Really, I promise! This is cut & paste with other dumb properties removed:

public class Address implements java.io.Serializable {

 private static final long serialVersionUID = 1L;
 private String addressLine1; 
 private String addressLine2; 

 public String getAddressLine1() {
  return addressLine1;
 }

 public void setAddressLine1(String addressLine1) {
  this.addressLine1 = addressLine1;
 }

 public String getAddressLine2() {
  return addressLine2;
 }

 public void setAddressLine2(String addressLine2) {
  this.addressLine2 = addressLine2;
 }
}

What in the heck is going on here? Is it some kind of weird scoping problem? Is it some kind of character encoding thing?

P.S. – I’m using spring’s SimpleJdbcTemplate, and the “pseudo database” I’m talking to is ProvideX which I’m accessing via ODBC (sun.jdbc.odbc.JdbcOdbcDriver).

  • 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-05-11T17:03:59+00:00Added an answer on May 11, 2026 at 5:03 pm

    Note what the javadocs say about ResultSet: “For maximum portability, result set columns within each row should be read in left-to-right order, and each column should be read only once.” So when you’re reading the column by using the debugger, that’s one read, then your code reads it a second time when setAddressLine1 is called.

    How does it behave when you only look at addressLine1 and don’t fiddle with the ResultSet?

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

Sidebar

Ask A Question

Stats

  • Questions 119k
  • Answers 119k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer +dictionaryWithObjects: returns an autoreleased dictionary -initWithObjects: you must release yourself… May 11, 2026 at 11:46 pm
  • Editorial Team
    Editorial Team added an answer You could try grouping inserts and updates into groups so… May 11, 2026 at 11:46 pm
  • Editorial Team
    Editorial Team added an answer Odds are you'll have to start tinkering with the files… May 11, 2026 at 11:46 pm

Related Questions

This one has me stumped. I've got a java.sql.ResultSet and I'm pulling string values
So...this one has me stumped. I am using VS 2008 (C#). I have some
On an ASP.NET MVC (Beta) site that I am developing sometimes calls to ActionLink
I'm having a problem updating a control on my ui from a thread created
I was surprised when I was able to reproduce a bug with a minimum

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.