commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Rufer <>
Subject Re: Problem with Result Set returning null instead of Empty String
Date Wed, 25 Jan 2006 11:50:01 GMT
On Wed, 25 Jan 2006, Chetan wrote:
> Earlier in my code, whenever i was doing a resultSet.getString('some column
> name'), the return value would be an empty string ('') in case the column in
> the database was null. However, after using DBCP, similar statements return

The JDBC specification (e.g. JDBC 3.0, Chapter states that for 
database rows that contain NULL: "Column values that map to Java Object 
types are returned as a Java null;"

Your implementation does not follow the JDBC specification, therefore it's 
not possible to change the implementation easily.

> Is there any way by which i could make the DBCP connection broker return an
> empty string instead of a null so that i dont need to make changes in
> numerous places in my application to handle the null pointer case ?

I strongly recommend you to follow the JDBC specification (better change 
your implementation now than later). This will make it possible to 
exchange the implementation as you like.

Stefan Rufer

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message