Forum Stats

  • 3,782,266 Users
  • 2,254,631 Discussions
  • 7,880,033 Comments

Discussions

Java Oracle JDBC question: ResultSet.getString removing characters on return?

johnnysubway
johnnysubway Member Posts: 8

I've never encountered this specific issue before, but it seems to happen when I call java.sql.ResultSet.getString(String columnName) on a column that represents a CITY name in an address table, if the string contains a "ss", as in the city name "Casselbury", the retrieved string looks like this: "Ca elbury". I don't know if this is a bug in either the Oracle JDBC driver or the Java SQL ResultSet, or if there's some other issue, but I'm at a loss to explain it! Anyone have any suggestions on how I can figure this out and/or correct the issue?

Thanks!

- Dave

Tagged:

Best Answer

Answers

  • I've never encountered this specific issue before, but it seems to happen when I call java.sql.ResultSet.getString(String columnName) on a column that represents a CITY name in an address table, if the string contains a "ss", as in the city name "Casselbury", the retrieved string looks like this: "Ca elbury". I don't know if this is a bug in either the Oracle JDBC driver or the Java SQL ResultSet, or if there's some other issue, but I'm at a loss to explain it! Anyone have any suggestions on how I can figure this out and/or correct the issue?

    The first thing that comes to mind is a character set difference between the DB character set and the client.

    1. Create and post a reproducible test case including the Java code

    2. Examine the actual DB characters involved by using the DUMP function on that table and column value (select column_name, DUMP (column_name) from myTable where id = 'abc') for the ONE row in the test case that can produce the problem

    3. Post the database character set

    4. Post the client/OS character set

    5. Post the specifics of the OS, Java, JDBC and DB: names and full versions.

    johnnysubway
  • johnnysubway
    johnnysubway Member Posts: 8
    Accepted Answer

    The issue turned out to be an unescaped regex keyword in the SQL statement (\s{2,} instead of \\s{2,}). Always gets me. Thanks for the assistance!

This discussion has been closed.