Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Oracle and empty strings

843859Apr 25 2010 — edited Apr 27 2010
Hi All,
i'm porting my application to Oracle and i'm experiencing (big) issues since empty strings are treated as null by Oracle.
This is a big issue for me since my application uses empty and null values as two different things (indeed they are different !!), ie, i'm not having null pointer exception, but wrong behavior.

I'm thinking what's the best approach to follow since my appl. must work also on mysql and postgres.
Three options at the moment:
1. implement a jdbc wrapper that converts any empty string in something like '~'.
2. using aspectj, add some aspects to setString/getString converting any empty string in something like '~'.
3. buy a commercial driver that makes difference between empty and null (using aforementioned approaches ?).

I think that this difference in Oracle is really an impediment in doing applications db neutral and I'd like to ask your opinion about the best solution (if someone already resolved it as i guess).
Does anyone know if there are commercial jdbc driver that can help me ?
Does anyone know how ORM frameworks (like hibernate) handle this case ?

Thanks in advance
ste
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 25 2010
Added on Apr 25 2010
9 comments
954 views