I have a simple query using JDBC of an Oracle database which is proving slow to retrieve, even though the query itself doesn't seem to be the problem. A profiler reveals that a lot of time is spent in:
ResultSet#getString(String)
methods, some of which are retrieving Oracle NUMBER
columns which are of Java long
precision, or thereabouts. These values may also be null.
I am guessing that getString(String)
is slow when returning a column value that is defined as a number - and thought about using getLong(String)
but of course that returns a primitive that cannot be null.
Is there a better way? Can a JDBC NUMERIC
value be returned as an object without converting it to a String
or incurring any other conversion cost?